weapon system help!!
#1

I made a perm weapon system.
The player can hold only 2 weapons, primary and secondary.
My question is: How can I make an update to check if the player has ammo in the weapon and if not.
so the weapon variable will update. or I can use it on OnPlayerUpdate


I made the stocks which checks if the player has ammo so it will return the weapon id otherwise it will return 0 as no gun in the slot.

Where can I use it to update?

pawn Код:
stock GetPrimaryWeapon(playerid)
{
    if(GetWeaponAmmo(playerid, PlayerInfo[playerid][pWep1]) > 0)
        return PlayerInfo[playerid][pWep1];
    else
        return 0;
}

stock GetSecondaryWeapon(playerid)
{
    if(GetWeaponAmmo(playerid, PlayerInfo[playerid][pWep2]) > 0)
        return PlayerInfo[playerid][pWep2];
    else
        return 0;
}
Reply
#2

Nevermind found a way without a timer

pawn Код:
if(RELEASED(KEY_FIRE))
    {
        if(GetWeaponAmmo(playerid, PlayerInfo[playerid][pWep1]) == 0) PlayerInfo[playerid][pWep1] = 0;
        if(GetWeaponAmmo(playerid, PlayerInfo[playerid][pWep2]) == 0) PlayerInfo[playerid][pWep2] = 0;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)