SA-MP Forums Archive
[Include] OnPlayerWeaponStateChange - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] OnPlayerWeaponStateChange (/showthread.php?tid=391761)



OnPlayerWeaponStateChange(Update[v0.2])! - Plovix - 11.11.2012

Hi,I'm gonna to show you my first callback!

It's called everytime when player changes his weapon state...


PHP код:
OnPlayerWeaponStateChange(playeridoldstatenewstate
You can find all weapon states at this link

Download(v 0.1):

Mediafire

Pastebin


Update (v 0.2)!

I create a small update.Changes:


-Minor bugs fixed
-Added weaponid and weaponname parameters


PHP код:
OnPlayerWeaponStateChange(playeridweaponidoldstatenewstateweaponname[]) 
Download(v 0.2):

Mediafire

Pastebin



Re: OnPlayerWeaponStateChange - XtremeR - 11.11.2012

Very nice for ur first callback!


Re: OnPlayerWeaponStateChange - Plovix - 11.11.2012

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
Very nice for ur first callback!
Thanks you


Re: OnPlayerWeaponStateChange - Ballu Miaa - 11.11.2012

Rep+6 for the work. Good one mate. Keep it up!


Re: OnPlayerWeaponStateChange - SuperViper - 11.11.2012

This will mess up certain callbacks that don't return 1.


Re: OnPlayerWeaponStateChange - Ballu Miaa - 11.11.2012

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
This will mess up certain callbacks that don't return 1.
Can you fix the code and upload it again for us Sv?


Re: OnPlayerWeaponStateChange - Lordzy - 12.11.2012

Simple and nice.
Btw, what do you mean by this?
pawn Код:
new ab[256];
//Then using it as ab[playerid]. Shouldn't it be:
new ab[MAX_PLAYERS];
And Ballu Miaa, here's that code
pawn Код:
public OnPlayerUpdate(playerid)
{
new ab[256];
ab[playerid] = GetPlayerWeaponState(playerid);
new pWeaponStatePlovixxx = strval(ab[playerid]);
if(pWeaponStatePlovixxx != pWeaponStatePlovixx[playerid])
CallLocalFunction("OnPlayerWeaponStateChange", "idd", playerid, pWeaponStatePlovixx[playerid], pWeaponStatePlovixxx);
pWeaponStatePlovixx[playerid] = pWeaponStatePlovixxx;
CallLocalFunction("ExampleOPU", "i", playerid);
return 1;
}



Re: OnPlayerWeaponStateChange - Dragony92 - 12.11.2012

pawn Код:
new ab[256];
ab[playerid] = GetPlayerWeaponState(playerid);
new pWeaponStatePlovixxx = strval(ab[playerid]);
LoL?

pawn Код:
new pWeaponStatePlovixxx = GetPlayerWeaponState(playerid);
This is enough....


Re: OnPlayerWeaponStateChange - Plovix - 12.11.2012

Thank you all for comments and reputations!I have update callback(v0.2).Changes:
-Minor bugs fixed
-Added weaponid and weaponname parameters


Re: OnPlayerWeaponStateChange - JaKe Elite - 12.11.2012

Never think of this before...
Nice job..