Guest User

Im_BanK

a guest
Jul 1st, 2008
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. if(strcmp(cmd, "/givedrugs", true) == 0)
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. tmp = strtok(cmdtext, idx);
  6. if(!strlen(tmp))
  7. {
  8. SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givedrugs [playerid/PartOfName] [amount]");
  9. return 1;
  10. }
  11. //giveplayerid = strval(tmp);
  12. giveplayerid = ReturnUser(tmp);
  13. tmp = strtok(cmdtext, idx);
  14. if(!strlen(tmp))
  15. {
  16. SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givedrugs [playerid/PartOfName] [amount]");
  17. return 1;
  18. }
  19. moneys = strval(tmp);
  20. if (IsPlayerConnected(giveplayerid))
  21. {
  22. if(giveplayerid != INVALID_PLAYER_ID)
  23. {
  24. if (ProxDetectorS(5.0, playerid, giveplayerid))
  25. {
  26. if(moneys > 0 && PlayerInfo[playerid][pDrugs] >= moneys)
  27. {
  28. ConsumingMoney[giveplayerid] = 1;
  29. PlayerInfo[giveplayerid][pDrugs] += moneys;
  30. PlayerInfo[playerid][pDrugs] -= moneys;
  31. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  32. GetPlayerName(playerid, sendername, sizeof(sendername));
  33. format(string, sizeof(string), " You have sent %s(player: %d), %d Drugs.", giveplayer,giveplayerid, moneys);
  34. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  35. SendClientMessage(playerid, COLOR_GRAD1, string);
  36. format(string, sizeof(string), " You have recieved %d Drugs from %s(player: %d).", moneys, sendername, playerid);
  37. SendClientMessage(giveplayerid, COLOR_GRAD1, string);
  38. format(string, sizeof(string), "%s has gived you %d Drugs to %s", sendername, moneys, giveplayer);
  39. PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
  40. format(string, sizeof(string), "* %s takes out some Drugs, and hands it to %s.", sendername ,giveplayer);
  41. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  42. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  43. {
  44. ApplyAnimation(playerid, "DEALER", "DEALER_DEAL", 4.0, 0, 0, 0, 0, 0);
  45. }
  46. }
  47. else
  48. {
  49. SendClientMessage(playerid, COLOR_GRAD2, " You dont have that much Drugs on you !");
  50. return 1;
  51. }
  52. }
  53. else
  54. {
  55. SendClientMessage(playerid, COLOR_GRAD1, " Your too far away.");
  56. }
  57. }//invalid id
  58. }
  59. else
  60. {
  61. format(string, sizeof(string), " %d is not an active player.", giveplayerid);
  62. SendClientMessage(playerid, COLOR_GRAD1, string);
  63. }
  64. }
  65. return 1;
  66. }
Add Comment
Please, Sign In to add comment