How to switch player weapon?
#4

Quote:
Originally Posted by PotH3Ad
Посмотреть сообщение
Try this:

pawn Код:
new LockWep[MAX_PLAYERS];
new LockOn[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    LockOn[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{
    if(LockOn[playerid] == 1)
    {
        if(GetPlayerWeapon(playerid) != LockWep[playerid]) SetPlayerArmedWeapon(playerid, LockWep[playerid]);
    }
    return 1;
}

//Use "LockPlayerWeapon(playerid, weaponid)" to set the player's locked weapon.
//Use "UnlockPlayerWeapon(playerid)" to disable the weapon lock

stock LockPlayerWeapon(playerid, weaponid)
{
    LockOn[playerid] = 1;
    LockWep[playerid] = weaponid;
    return 1;
}

stock UnlockPlayerWeapon(playerid)
{
    LockOn[playerid] = 0;
    LockWep[playerid] = -1;
}
Thanks, I'll try it out. Will post back if it works.

EDIT: It works, thanks
Reply


Messages In This Thread
How to switch player weapon? - by Outcast - 08.07.2011, 05:49
Re: How to switch player weapon? - by [HiC]TheKiller - 08.07.2011, 06:09
Re: How to switch player weapon? - by PotH3Ad - 08.07.2011, 06:09
Re: How to switch player weapon? - by Outcast - 08.07.2011, 06:21

Forum Jump:


Users browsing this thread: 1 Guest(s)