Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define INVALID_WEAPON 0
- #define MAX_WEAPON_SLOTS 13
- #define MAX_WEAPONS 47
- /////////////////////////////////////////////////////////////////////////////////
- static pWeaponData[MAX_PLAYERS][MAX_WEAPON_SLOTS];
- static const WeaponSlot[MAX_WEAPONS] =
- {
- 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
- };
- /////////////////////////////////////////////////////////////////////////////////
- //THIS SHOULD GO AT THE TOP OF THE SCRIPT
- //DO NOT PUT THIS DOWN OR ELSE THE SCRIPT WONT WORK
- stock ac_GivePlayerWeapon(playerid,weaponid,ammo)
- {
- pWeaponData[playerid][WeaponSlot[weaponid]] = weaponid;
- return GivePlayerWeapon(playerid,weaponid,ammo);
- }
- #if defined _ALS_GivePlayerWeapon
- #undef GivePlayerWeapon
- #else
- #define _ALS_GivePlayerWeapon
- #endif
- #define GivePlayerWeapon ac_GivePlayerWeapon
- stock ac_ResetPlayerWeapons(playerid)
- {
- for(new i = 0; i < MAX_WEAPON_SLOTS;i++) pWeaponData[playerid][i] = INVALID_WEAPON;
- return ResetPlayerWeapons(playerid);
- }
- #if defined _ALS_ResetPlayerWeapons
- #undef ResetPlayerWeapons
- #else
- #define _ALS_ResetPlayerWeapons
- #endif
- #define ResetPlayerWeapons ac_ResetPlayerWeapons
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //PUT THE CODE INSIDE THE FUNCTION TO YOUR 1s TIMER
- forward WeaponCheck();
- public WeaponCheck()
- {
- static wid;
- for(new playerid = 0; playerid <= GetMaxPlayers(); playerid++)
- {
- switch(GetPlayerState(playerid))
- {
- case PLAYER_STATE_NONE,PLAYER_STATE_WASTED,PLAYER_STATE_SPAWNED: continue;
- }
- wid = GetPlayerWeapon(playerid);
- if(wid == -1) continue; //INVALID WEAPON
- if(pWeaponData[playerid][WeaponSlot[wid]] != wid)
- {
- new str[144],name[24],wname[24];
- GetPlayerName(playerid,name,sizeof(name));
- GetWeaponName(wid,wname,sizeof(wname));
- format(str,256,"%s(%d) suspected to be using Weapon Hacks (Weapon Name:%s)",name,playerid,wname);
- SendClientMessageToAll(-1,str);
- }
- continue;
- }
- }
- public OnPlayerConnect(playerid)
- {
- ResetPlayerWeapons(playerid);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid,22,100);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement