Problem custom. - 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)
+--- Thread: Problem custom. (
/showthread.php?tid=572987)
Problem custom. -
Baltimore - 03.05.2015
Hi.
I use
OnPlayerChangeWeapon in
OnPlayerUpdate for check if player switch weapon.
The "basic" code:
pawn Код:
if(GetPlayerWeapon(playerid) != Lastgun[playerid])
{
OnPlayerChangeWeapon(playerid, Lastgun[playerid], GetPlayerWeapon(playerid));
}
Lastgun[playerid] = GetPlayerWeapon(playerid);
However I want to use as a parameter in the callback
OnPlayerChangeWeapon the id of my custom weapons.
I did that:
pawn Код:
new id_array = -1;
for(new w; w < sizeof(wep_Data); w++)
{
if(wep_Data[w][wep_CustomWeapon] != -1 && wep_Data[w][wep_CustomWeapon] == Armes[playerid][ActiveWeapon[playerid]][Model]) // Arme actu
{
id_array = w;
}
}
if(id_array != -1)
{
if(wep_Data[id_array][wep_CustomWeapon] != AncienneArme[playerid])
{
OnPlayerChangeWeapon(playerid, AncienneArme[playerid], wep_Data[id_array][wep_CustomWeapon]);
}
AncienneArme[playerid] = wep_Data[id_array][wep_CustomWeapon];
}
However when I callback weapon switch
OnPlayerChangeWeapon is not called .
I found that in my for loop I use
Weapons [ playerid ] [ ActiveWeapon [ playerid ]] [Model ] to make the comparison ( This variable stores the id of the custom weapon the player has in hand) , it remains unchanged thereafter, but I do not want to change right away, only
OnPlayerChangeWeapon .
Thank you .
Re : Problem custom. -
Baltimore - 03.05.2015
Up, please, it's important.
Re : Problem custom. -
Baltimore - 04.05.2015
UPPP.