Advertisement
Guest User

/transfer

a guest
Mar 15th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. if(strcmp(cmd, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0)
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. if(PlayerInfo[playerid][pLevel] < 3)
  6. {
  7. SendClientMessage(playerid, COLOR_GRAD1, " You must be level 3 !");
  8. return 1;
  9. }
  10. if(PlayerInfo[playerid][pLocal] != 103)
  11. {
  12. SendClientMessage(playerid, COLOR_GREY, " You are not at the Bank !");
  13. return 1;
  14. }
  15. tmp = strtok(cmdtext, idx);
  16. if(!strlen(tmp))
  17. {
  18. SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /transfer [playerid/PartOfName] [amount]");
  19. return 1;
  20. }
  21. giveplayerid = ReturnUser(tmp);
  22. tmp = strtok(cmdtext, idx);
  23. if(!strlen(tmp))
  24. {
  25. SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /transfer [playerid/PartOfName] [amount]");
  26. return 1;
  27. }
  28. moneys = strval(tmp);
  29. if (IsPlayerConnected(giveplayerid))
  30. {
  31. if(giveplayerid != INVALID_PLAYER_ID)
  32. {
  33. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  34. GetPlayerName(playerid, sendername, sizeof(sendername));
  35. playermoney = PlayerInfo[playerid][pAccount] ;
  36. if (moneys > 0 && playermoney >= moneys)
  37. {
  38. PlayerInfo[playerid][pAccount] -= moneys;
  39. PlayerInfo[giveplayerid][pAccount] += moneys;
  40. format(string, sizeof(string), " You have transferd $%d to %s's account", moneys, giveplayer,giveplayerid);
  41. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  42. SendClientMessage(playerid, COLOR_GRAD1, string);
  43. format(string, sizeof(string), " You have recieved $%d to into your account from %s", moneys, sendername, playerid);
  44. SendClientMessage(giveplayerid, COLOR_GRAD1, string);
  45. format(string, sizeof(string), "%s transferd $%d to %s", sendername, moneys, giveplayer);
  46. if(moneys >= 500000)
  47. {
  48. ABroadCast(COLOR_YELLOW,string,1);
  49. }
  50. printf("%s", string);
  51. PayLog(string);
  52. PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
  53. }
  54. else
  55. {
  56. SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount.");
  57. }
  58. }
  59. }
  60. else
  61. {
  62. format(string, sizeof(string), " %d is not an active player.", giveplayerid);
  63. SendClientMessage(playerid, COLOR_GRAD1, string);
  64. }
  65. }
  66. return 1;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement