Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by Lavamike
Quote:
Originally Posted by Calgon
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.
|
So just use the same method you did...
pawn Код:
switch(newweapon) { case 1,2: { // Stuff here } }
|
I was correcting him and pointing out something. And I am using mine, learn how actually evaluate sentences.