Guest User

Untitled

a guest
Jul 1st, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. Function ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. new Float:posx, Float:posy, Float:posz;
  6. new Float:oldposx, Float:oldposy, Float:oldposz;
  7. new Float:tempposx, Float:tempposy, Float:tempposz;
  8. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  9. //radi = 2.0; //Trigger Radius
  10. for(new i = 0; i < MAX_PLAYERS; i++)
  11. {
  12. if(IsPlayerConnected(i))
  13. {
  14. if(!BigEar[i])
  15. {
  16. GetPlayerPos(i, posx, posy, posz);
  17. tempposx = (oldposx -posx);
  18. tempposy = (oldposy -posy);
  19. tempposz = (oldposz -posz);
  20. //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  21. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  22. {
  23. SendClientMessage(i, col1, string);
  24. }
  25. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  26. {
  27. SendClientMessage(i, col2, string);
  28. }
  29. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  30. {
  31. SendClientMessage(i, col3, string);
  32. }
  33. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  34. {
  35. SendClientMessage(i, col4, string);
  36. }
  37. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  38. {
  39. SendClientMessage(i, col5, string);
  40. }
  41. }
  42. else
  43. {
  44. SendClientMessage(i, col1, string);
  45. }
  46. }
  47. }
  48. }
  49. return 1;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment