Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. if(strcmp(cmd, "/sethpinradius", true) == 0)
  2. {
  3. new str[MAX_STRING];
  4. if(PlayerInfo[playerid][pAdmin] > 10)
  5. {
  6. tmp = strtok(cmdtext, idx);
  7. if(!strlen(tmp))
  8. {
  9. SendClientMessage(playerid, COLOR_RED, "Usage: /sethpinradius [Radius] [Health]");
  10. return 1;
  11. }
  12. new radius;
  13. radius = strval(tmp);
  14. tmp = strtok(cmdtext, idx);
  15. if(!strlen(tmp))
  16. {
  17. SendClientMessage(playerid, COLOR_RED, "Usage: /sethpinradius [Radius] [Health] - 2");
  18. return 1;
  19. }
  20. new hp, Float:health;
  21. hp = strval(tmp);
  22. new Float:x,Float:y,Float:z;
  23. new Float:x1,Float:y1,Float:z1;
  24. GetPlayerPos(playerid,x,y,z);
  25. for(new i = 0; i < MAX_PLAYERS; i++)
  26. {
  27. if(PlayerToPoint(radius, i, x, y, z) && i != playerid)
  28. {
  29. SetPlayerHealth(i, GetPlayerHealth(i,health) + hp);
  30.  
  31. GetPlayerPos(i,x1,y1,z1);
  32. new Float:Distance;
  33. new Float:xd,Float:yd,Float:zd;
  34. xd = x1 - x;
  35. yd = y1 - y;
  36. zd = z1 - z;
  37. Distance = floatsqroot(xd*xd + yd*yd + zd*zd);
  38. new name[32];
  39. GetPlayerName(i, name, sizeof(name));
  40. format(str, sizeof(str), "Your distance from %s, is %f", name, Distance);
  41. SendClientMessage(playerid, TEAM_CYAN_COLOR, str);
  42. }
  43. else
  44. {
  45. SendClientMessage(playerid, COLOR_RED, "Except you, everyone in the radius had those HP");
  46. return 1;
  47. }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement