Problem custom.
#1

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 .
Reply
#2

Up, please, it's important.
Reply
#3

UPPP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)