SA-MP Forums Archive
How do I check if a player's weapon change? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How do I check if a player's weapon change? (/showthread.php?tid=233001)



How do I check if a player's weapon change? - Sasino97 - 28.02.2011

How do I check if a player's weapon change?

I tried everything, but it doesnt work.

I tried to set a timer on player connect that checks for first weapon and a timer that checks for the second weapon, and it works only if you change that weapon in 50 cs.

Please help.

Thanks.


Re: How do I check if a player's weapon change? - park4bmx - 28.02.2011

Use if(GetPlayerWeapon(playerid) == WeaponID)

Do this
pawn Код:
SetTimer("CheckWeapons",1000,true); //This Goes To |OnPlayerConnect|

//Then
forward CheckWeapons(playerid);
public CheckWeapons(playerid)
{
if(GetPlayerWeapon(playerid) == 38)
     {
     SendCLientMEssage(playerid,YELLOW,"You have a minigun!!!");
     } //This si a MiniGun is an Example
return 1;
}



Re: How do I check if a player's weapon change? - Sasino97 - 28.02.2011

lol, thanks, but I don't want this xD, I want something like:

OnPlayerWeaponStateChange(playerid, oldweapon, newweapon);


Re: How do I check if a player's weapon change? - Fj0rtizFredde - 28.02.2011

There is an example at the OnPlayerUpdate article at the wiki https://sampwiki.blast.hk/wiki/OnPlayerUpdate


Re: How do I check if a player's weapon change? - Prumpuz - 28.02.2011

https://sampforum.blast.hk/showthread.php?tid=59771 There's a OnPlayerWeaponChange callback here. Hope that helps.


Re: How do I check if a player's weapon change? - Sasino97 - 01.03.2011

Thank you! It works