proxdetector.pwn 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ProxDetector(Float: f_Radius, playerid, string[],col1,col2,col3,col4,col5, chat=0, chattype = -1, ooc = -1)
  2. {
  3. if(GetPVarType(playerid, "WatchingTV")) return 1;
  4. new
  5. Float: f_playerPos[3];
  6. GetPlayerPos(playerid, f_playerPos[0], f_playerPos[1], f_playerPos[2]);
  7. new str[128];
  8. foreach(new i: Player)
  9. {
  10. if((InsidePlane[playerid] == GetPlayerVehicleID(i) && GetPlayerState(i) == 2) || (InsidePlane[i] == GetPlayerVehicleID(playerid) && GetPlayerState(playerid) == 2) || (InsidePlane[playerid] != INVALID_VEHICLE_ID && InsidePlane[playerid] == InsidePlane[i])) {
  11. SendClientMessageEx(i, col1, string);
  12. }
  13. else if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid)) {
  14. if(chat && ooc == -1 && IsPlayerInRangeOfPoint(i, f_Radius * 0.6, f_playerPos[0], f_playerPos[1], f_playerPos[2]) && PlayerInfo[i][pBugged] >= 0)
  15. {
  16. printf("");
  17. if(playerid == i)
  18. {
  19. format(str, sizeof(str), "{8D8DFF}(BUGGED) {CBCCCE}%s", string);
  20. }
  21. else {
  22. format(str, sizeof(str), "{8D8DFF}(BUG ID %d) {CBCCCE}%s", i,string);
  23. }
  24. if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pTogReports] == 1 || PlayerInfo[playerid][pAdmin] < 2 || PlayerInfo[i][pAdmin] >= 2 && PlayerInfo[i][pTogReports] == 1 || PlayerInfo[i][pAdmin] < 2) SendBugMessage(i, PlayerInfo[i][pBugged], str);
  25. }
  26. if(IsPlayerInRangeOfPoint(i, f_Radius / 16, f_playerPos[0], f_playerPos[1], f_playerPos[2])) {
  27. if(chattype != -1) ChatTrafficProcess(i, col1, string, chattype);
  28. else SendClientMessageEx(i, col1, string);
  29. }
  30. else if(IsPlayerInRangeOfPoint(i, f_Radius / 8, f_playerPos[0], f_playerPos[1], f_playerPos[2])) {
  31. if(chattype != -1) ChatTrafficProcess(i, col2, string, chattype);
  32. else SendClientMessageEx(i, col2, string);
  33. }
  34. else if(IsPlayerInRangeOfPoint(i, f_Radius / 4, f_playerPos[0], f_playerPos[1], f_playerPos[2])) {
  35. if(chattype != -1) ChatTrafficProcess(i, col3, string, chattype);
  36. else SendClientMessageEx(i, col3, string);
  37. }
  38. else if(IsPlayerInRangeOfPoint(i, f_Radius / 2, f_playerPos[0], f_playerPos[1], f_playerPos[2])) {
  39. if(chattype != -1) ChatTrafficProcess(i, col4, string, chattype);
  40. else SendClientMessageEx(i, col4, string);
  41. }
  42. else if(IsPlayerInRangeOfPoint(i, f_Radius, f_playerPos[0], f_playerPos[1], f_playerPos[2])) {
  43. if(chattype != -1) ChatTrafficProcess(i, col5, string, chattype);
  44. else SendClientMessageEx(i, col5, string);
  45. }
  46. }
  47. if(GetPVarInt(i, "BigEar") == 1 || GetPVarInt(i, "BigEar") == 6 && GetPVarInt(i, "BigEarPlayer") == playerid) {
  48. new string2[128] = "(BE) ";
  49. strcat(string2,string, sizeof(string2));
  50. SendClientMessageEx(i, col1,string);
  51. }
  52. }
  53. return 1;
  54. }
  55. ProxDetectorS(Float:radi, playerid, targetid)
  56. {
  57. if(GetPVarType(playerid, "WatchingTV")) return 1;
  58. if(Spectating[targetid] != 0 && PlayerInfo[playerid][pAdmin] < 2)
  59. {
  60. return 0;
  61. }
  62. new
  63. Float: fp_playerPos[3];
  64. GetPlayerPos(targetid, fp_playerPos[0], fp_playerPos[1], fp_playerPos[2]);
  65. if(IsPlayerInRangeOfPoint(playerid, radi, fp_playerPos[0], fp_playerPos[1], fp_playerPos[2]) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
  66. {
  67. return 1;
  68. }
  69. return 0;
  70. }
  71. ProxDetectorWrap(playerid, string[], width, Float:wrap_radius, col1, col2, col3, col4, col5)
  72. {
  73. if(strlen(string) > width)
  74. {
  75. new firstline[128], secondline[128];
  76. strmid(firstline, string, 0, 88);
  77. strmid(secondline, string, 88, 150);
  78. format(firstline, sizeof(firstline), "%s...", firstline);
  79. format(secondline, sizeof(secondline), "...%s", secondline);
  80. ProxDetector(wrap_radius, playerid, firstline, col1, col2, col3, col4, col5);
  81. ProxDetector(wrap_radius, playerid, secondline, col1, col2, col3, col4, col5);
  82. }
  83. else ProxDetector(wrap_radius, playerid, string, col1, col2, col3, col4, col5);
  84. }