Custom weapon, problem.
#7

pawn Код:
public OnPlayerUpdate(playerid)
{
    new iCurWeap = GetPlayerWeapon(playerid); // Return the player's current weapon    
    if(iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // If he changed weapons since the last update
    {
        // Lets call a callback named OnPlayerChangeWeapon
        OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
        SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Update the weapon variable
    }
    return 1; // Send this update to other players.
}
 
stock OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
    new     s[128],
        oWeapon[24],
        nWeapon[24];
 
    GetWeaponName(oldweapon, oWeapon, sizeof(oWeapon));
    GetWeaponName(newweapon, nWeapon, sizeof(nWeapon));
 
    format(s, sizeof(s), "You changed weapon from %s to %s!", oWeapon, nWeapon);
 
    SendClientMessage(playerid, 0xFFFFFFFF, s);
}
I have a variable that can store the weapon in my hand, and its number of ammos.

How to change the value of the variable when I switch my weapon etc?
Reply


Messages In This Thread
Custom weapon, problem. - by Baltimore - 28.03.2015, 19:43
Re : Custom weapon, problem. - by Baltimore - 29.03.2015, 09:14
Re: Custom weapon, problem. - by CalvinC - 29.03.2015, 09:19
Re : Custom weapon, problem. - by Baltimore - 29.03.2015, 09:37
Re : Custom weapon, problem. - by Baltimore - 29.03.2015, 16:09
Re: Custom weapon, problem. - by CalvinC - 29.03.2015, 16:14
Re : Custom weapon, problem. - by Baltimore - 29.03.2015, 16:35
Re : Custom weapon, problem. - by S4t3K - 29.03.2015, 16:49
Re : Custom weapon, problem. - by Baltimore - 29.03.2015, 17:13
Re: Custom weapon, problem. - by CalvinC - 29.03.2015, 18:30

Forum Jump:


Users browsing this thread: 1 Guest(s)