Advertisement
YashasSamaga

Untitled

Sep 23rd, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. #define INVALID_WEAPON 0
  2. #define MAX_WEAPON_SLOTS 13
  3. #define MAX_WEAPONS 47
  4. /////////////////////////////////////////////////////////////////////////////////
  5. static pWeaponData[MAX_PLAYERS][MAX_WEAPON_SLOTS];
  6. static const WeaponSlot[MAX_WEAPONS] =
  7. {
  8. 0,0,1,1,1,1,1,1,1,1,10,10,10,10,10,10,8,8,8,-1,-1,-1,2,2,2,3,3,3,4,4,5,5,4,6,6,7,7,7,7,8,12,9,9,9,11,11,11
  9. };
  10. /////////////////////////////////////////////////////////////////////////////////
  11. //THIS SHOULD GO AT THE TOP OF THE SCRIPT
  12. //DO NOT PUT THIS DOWN OR ELSE THE SCRIPT WONT WORK
  13. stock ac_GivePlayerWeapon(playerid,weaponid,ammo)
  14. {
  15. pWeaponData[playerid][WeaponSlot[weaponid]] = weaponid;
  16. return GivePlayerWeapon(playerid,weaponid,ammo);
  17. }
  18.  
  19. #if defined _ALS_GivePlayerWeapon
  20. #undef GivePlayerWeapon
  21. #else
  22. #define _ALS_GivePlayerWeapon
  23. #endif
  24.  
  25. #define GivePlayerWeapon ac_GivePlayerWeapon
  26.  
  27. stock ac_ResetPlayerWeapons(playerid)
  28. {
  29. for(new i = 0; i < MAX_WEAPON_SLOTS;i++) pWeaponData[playerid][i] = INVALID_WEAPON;
  30. return ResetPlayerWeapons(playerid);
  31. }
  32.  
  33. #if defined _ALS_ResetPlayerWeapons
  34. #undef ResetPlayerWeapons
  35. #else
  36. #define _ALS_ResetPlayerWeapons
  37. #endif
  38.  
  39. #define ResetPlayerWeapons ac_ResetPlayerWeapons
  40. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  41. //PUT THE CODE INSIDE THE FUNCTION TO YOUR 1s TIMER
  42. forward WeaponCheck();
  43. public WeaponCheck()
  44. {
  45. static wid;
  46. for(new playerid = 0; playerid <= GetMaxPlayers(); playerid++)
  47. {
  48. switch(GetPlayerState(playerid))
  49. {
  50. case PLAYER_STATE_NONE,PLAYER_STATE_WASTED,PLAYER_STATE_SPAWNED: continue;
  51. }
  52.  
  53. wid = GetPlayerWeapon(playerid);
  54. if(wid == -1) continue; //INVALID WEAPON
  55.  
  56. if(pWeaponData[playerid][WeaponSlot[wid]] != wid)
  57. {
  58. new str[144],name[24],wname[24];
  59. GetPlayerName(playerid,name,sizeof(name));
  60. GetWeaponName(wid,wname,sizeof(wname));
  61. format(str,256,"%s(%d) suspected to be using Weapon Hacks (Weapon Name:%s)",name,playerid,wname);
  62. SendClientMessageToAll(-1,str);
  63. }
  64. continue;
  65. }
  66. }
  67. public OnPlayerConnect(playerid)
  68. {
  69. ResetPlayerWeapons(playerid);
  70. return 1;
  71. }
  72. public OnPlayerSpawn(playerid)
  73. {
  74. ResetPlayerWeapons(playerid);
  75. GivePlayerWeapon(playerid,22,100);
  76. return 1;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement