Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by TimmehBoy
Even easier
At the top of script
pawn Код:
new CurrentWeapon[MAX_PLAYERS];
pawn Код:
public OnPlayerUpdate(playerid) { if(CurrentWeapon[playerid] != GetPlayerWeapon(playerid)) { OnPlayerWeaponChange(playerid, CurrentWeapon[playerid], GetPlayerWeapon(playerid)); CurrentWeapon[playerid] = GetPlayerWeapon(playerid); } }
stock OnPlayerWeaponChange(playerid, oldweapon, newweapon) { if(newweapon == WEAPONHERE) { //do whatever you want } return true; }
I'm using such callbacks for my anti-cheat. Works perfectly (faster than timer).
|
And your system supports ONE weapon, so that's kind of stupid. My system blacklists a bunch of weapons and bans if a player has it.