Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. static ZZ_Timer;
  4. #define IP_F 1000
  5.  
  6.  
  7. enum nn
  8. {
  9. ip[14],
  10. adv
  11. }
  12. new ZZInfo[IP_F][nn];
  13.  
  14. forward ZZ_cTroll();
  15. forward EsTroll(playerid);
  16.  
  17.  
  18. public OnFilterScriptInit()
  19. {
  20. ZZ_Timer = SetTimer("ZZ_cTroll", 1000, true);
  21. return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26. KillTimer(ZZ_Timer);
  27. for (new i = 1; i < IP_F; i++)
  28. {
  29. ZZInfo[i][ip] = 0;
  30. ZZInfo[i][adv] = 0;
  31. }
  32. return 1;
  33. }
  34.  
  35. public ZZ_cTroll()
  36. {
  37. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  38. {
  39. if(IsPlayerConnected(i))
  40. {
  41. if(IsPlayerInAnyVehicle(i))
  42. {
  43. if(GetPlayerVehicleID(i) != GetPVarInt(i, "ZZ_Coche"))
  44. {
  45. if(gettime() > GetPVarInt(i, "ZZ_Tiempo"))
  46. {
  47. EsTroll(i);
  48. }
  49. }
  50. }
  51. }
  52. }
  53. }
  54.  
  55. public OnPlayerStateChange(playerid, newstate, oldstate)
  56. {
  57. if(newstate == PLAYER_STATE_DRIVER)
  58. {
  59. if(GetPVarInt(playerid, "ZZ_RJack") == 1)
  60. {
  61. EsTroll(playerid);
  62. }
  63. if(oldstate == PLAYER_STATE_PASSENGER)
  64. {
  65. EsTroll(playerid);
  66. }
  67. }
  68. return 1;
  69. }
  70.  
  71. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  72. {
  73. SetPVarInt(playerid, "ZZ_Coche", vehicleid);
  74. if(!ispassenger)
  75. {
  76. SetPVarInt(playerid, "ZZ_RJack", 1);
  77. }
  78. return 1;
  79. }
  80.  
  81.  
  82. public OnPlayerUpdate(playerid)
  83. {
  84. if(GetPVarInt(playerid, "ZZ_RJack") == 1 && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_ENTER_VEHICLE)
  85. {
  86. SetPVarInt(playerid, "ZZ_RJack", 0);
  87. SetPVarInt(playerid, "ZZ_Tiempo", gettime()+3);
  88. }
  89. return 1;
  90. }
  91.  
  92.  
  93. public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
  94. {
  95. if(floatround(floatsqroot(vel_x * vel_x + vel_y * vel_y) * 200, floatround_round) > 1100)
  96. {
  97. EsTroll(playerid);
  98. return 0;
  99. }
  100. if(GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 15)
  101. {
  102. return 0;
  103. }
  104. return 1;
  105. }
  106.  
  107. stock ZZ_PutPlayerInVehicle(playerid, vehicleid, seatid)
  108. {
  109. SetPVarInt(playerid, "ZZ_Tiempo", gettime()+3);
  110. SetPVarInt(playerid, "ZZ_Coche", vehicleid);
  111. SetPVarInt(playerid, "ZZ_RJack", 0);
  112. return PutPlayerInVehicle(playerid, vehicleid, seatid);
  113. }
  114.  
  115. stock ZZ_RemovePlayerFromVehicle(playerid)
  116. {
  117. SetPVarInt(playerid, "ZZ_Tiempo", gettime()+3);
  118. SetPVarInt(playerid, "ZZ_Coche", 0);
  119. SetPVarInt(playerid, "ZZ_RJack", 0);
  120. return RemovePlayerFromVehicle(playerid);
  121. }
  122.  
  123.  
  124. public EsTroll(playerid)
  125. {
  126. new plrIP [ 16 ] ;
  127. GetPlayerIp ( playerid, plrIP, sizeof ( plrIP ) ) ;
  128.  
  129. for (new i = 1; i < IP_F; i++)
  130. {
  131. if(ZZInfo[i][ip] == strval(plrIP))
  132. {
  133. if(ZZInfo[i][adv] == 3)
  134. {
  135. SendClientMessage(playerid, -1, "<<[ZZ_Anti-Troll]>> Baneado, límite de advertencias.");
  136. Ban(playerid);
  137. }else{
  138. ZZInfo[i][ip] = strval(plrIP);
  139. ZZInfo[i][adv]++;
  140. new string[150];
  141. format(string, 128, "<<[ZZ_Anti-Troll]>> Kickeado, no uses cheats o serás baneado. %d/3", ZZInfo[ip][adv]);
  142. SendClientMessage(playerid, -1, string);
  143. Kick(playerid);
  144. }
  145. }
  146. }
  147. return 1;
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement