Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. CMD:shakehand(playerid, params[])
  2. {
  3. new string[128], giveplayerid, style;
  4. if(sscanf(params, "ud", giveplayerid, style)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /shakehand [playerid] [style (1-8)]");
  5.  
  6. if(IsPlayerConnected(giveplayerid))
  7. {
  8. if(giveplayerid == playerid)
  9. {
  10. SendClientMessageEx(playerid, COLOR_GREY, "You can't shake your own hand.");
  11. return 1;
  12. }
  13. if(style >= 1 && style < 9)
  14. {
  15. new Float: ppFloats[3];
  16.  
  17. GetPlayerPos(giveplayerid, ppFloats[0], ppFloats[1], ppFloats[2]);
  18.  
  19. if(!IsPlayerInRangeOfPoint(playerid, 5, ppFloats[0], ppFloats[1], ppFloats[2]))
  20. {
  21. SendClientMessageEx(playerid, COLOR_GREY, "You're too far away. You can't shake hands right now.");
  22. return 1;
  23. }
  24.  
  25. SetPVarInt(playerid, "shrequest", giveplayerid);
  26. SetPVarInt(playerid, "shstyle", style);
  27.  
  28. format(string, sizeof(string), "You have requested to shake %s's hand, please wait for them to respond.", GetPlayerNameEx(giveplayerid));
  29. SendClientMessageEx(playerid, COLOR_WHITE, string);
  30.  
  31. format(string, sizeof(string), "%s has requested to shake your hand, please use '/accept handshake' to approve the hand shake.", GetPlayerNameEx(playerid));
  32. SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
  33. }
  34. else
  35. {
  36. SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /shakehand [playerid] [style (1-8)]");
  37. }
  38. }
  39. else
  40. {
  41. SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  42. }
  43. return 1;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement