Advertisement
zBreno

Anti DriverBy for NOP SetPlayerArmedWeapon

Nov 19th, 2023 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.64 KB | Source Code | 0 0
  1. // Anti DriverBy for NOP SetPlayerArmedWeapon
  2. // Steam id /zbreno1993
  3.  
  4. #include <a_samp>
  5.  
  6. // Detecting holding a key
  7. // HOLDING(keys)
  8. #define HOLDING(%0) \
  9. ((newkeys & (%0)) == (%0))
  10.  
  11. // don't use this to ban player, exist a delay that get player armed same while the weapon has removed
  12.  
  13. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  14. {
  15. SetPlayerArmedWeapon(playerid, 0);
  16. return 1;
  17. }
  18.  
  19. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  20. {
  21. if(HOLDING( KEY_FIRE ))
  22. {
  23. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  24. {
  25. if(GetPlayerWeapon(playerid) == 29)
  26. {
  27. Kick(playerid);
  28. }
  29. }
  30. }
  31. if(HOLDING( KEY_FIRE | KEY_LOOK_RIGHT ))
  32. {
  33. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  34. {
  35. if(GetPlayerWeapon(playerid) == 29)
  36. {
  37. Kick(playerid);
  38. }
  39. }
  40. }
  41. if(HOLDING( KEY_FIRE | KEY_LOOK_LEFT ))
  42. {
  43. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  44. {
  45. if(GetPlayerWeapon(playerid) == 29)
  46. {
  47. Kick(playerid);
  48. }
  49. }
  50. }
  51. return 1;
  52. }
  53.  
  54. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  55. {
  56. //if(IsPlayerInAnyVehicle(playerid)) Kick(playerid);
  57. if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) Kick(playerid);
  58. return 1;
  59. }
  60.  
  61. public OnPlayerUpdate(playerid)
  62. {
  63. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
  64. {
  65. SetPlayerArmedWeapon(playerid, 0);
  66. }
  67.  
  68. // remova se o jogador tiver sendo constantemente kickado
  69. // remove if player is constantly kicked
  70.  
  71. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
  72. {
  73. if(GetPlayerWeapon(playerid) != 0) Kick(playerid);
  74. }
  75. return 1;
  76. }
Tags: pawn
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement