Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if !defined isnull
- #define isnull(%1) \
- ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
- #endif
- stock GivePlayerWeaponEx(playerid,weaponid,ammo) {
- new str[32];
- format(str,sizeof(str),"Weapon%d",weaponid);
- SetPVarInt(playerid,str,weaponid);
- return GivePlayerWeapon(playerid,weaponid,ammo);
- }
- #if defined _ALS_GivePlayerWeapon
- #undef GivePlayerWeapon
- #else
- #define _ALS_GivePlayerWeapon
- #endif
- #define GivePlayerWeapon GivePlayerWeaponEx
- stock ResetPlayerWeaponsEx(playerid) {
- resetWeaponAntiCheat(playerid);
- return ResetPlayerWeapons(playerid);
- }
- #if defined _ALS_ResetPlayerWeapons
- #undef ResetPlayerWeapons
- #else
- #define _ALS_ResetPlayerWeapons
- #endif
- #define ResetPlayerWeapons ResetPlayerWeaponsEx
- forward OnWeaponAntiCheat(playerid, reason[]);
- public OnWeaponAntiCheat(playerid, reason[]) {
- new str[32],weaponname[32];
- for(new i=0; i<=MAX_PLAYERS; i++) {
- if(IsPlayerConnected(i) && GetPlayerState(playerid) != PLAYER_STATE_NONE) {
- new weaponid = GetPlayerWeapon(playerid);
- format(str,sizeof(str),"Weapon%d",weaponid);
- if(GetPVarInt(playerid,str) != weaponid) {
- GetWeaponName(weaponid,weaponname,sizeof(weaponname));
- }
- }
- }
- if(!isnull(weaponname)) return CallRemoteFunction("WAC_OnWeaponAntiCheat","ds",playerid,weaponname);
- else return 1;
- }
- #if defined _ALS_OnWeaponAntiCheat
- #undef OnWeaponAntiCheat
- #else
- #define _ALS_OnWeaponAntiCheat
- #endif
- #define OnWeaponAntiCheat WAC_OnWeaponAntiCheat
- forward WAC_OnWeaponAntiCheat(playerid, reason[]);
- public OnPlayerDeath(playerid, killerid, reason) {
- resetWeaponAntiCheat(playerid);
- return CallLocalFunction("WAC_OnPlayerDeath","ddd",playerid,killerid,reason);
- }
- #if defined _ALS_OnPlayerDeath
- #undef OnPlayerDeath
- #else
- #define _ALS_OnPlayerDeath
- #endif
- #define OnPlayerDeath WAC_OnPlayerDeath
- forward WAC_OnPlayerDeath(playerid, killerid, reason);
- stock resetWeaponAntiCheat(playerid) {
- new str[32];
- for(new i=1; i<=46; i++) {
- format(str,sizeof(str),"Weapon%d",i);
- if(!GetPVarInt(playerid,str)) continue;
- SetPVarInt(playerid,str,0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement