SetPlayerAmmo
#1

Well I want it to set the players ammo to -20 when they get in the car, but whenever I use this function. It does nothing at all. Does anyone know a way to make it so I can set the players ammo to -20 while being the driver of the car?
Reply
#2

I'm pretty sure none of the weapon functions except SetPlayerArmedWeapon() work if a player is in a vehicle.

You can set their weapon to 0 (fists) instead, using SetPlayerArmedWeapon().
Reply
#3

Why do you want that? - So that he can't shoot? Just do this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        SetPVarInt(playerid, "OldWep", GetPlayerWeapon(playerid);
        SetPlayerArmedWeaopn(playerid, 0);
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        SetPlayerArmedWeapon(playerid, GetPVarInt(playerid, "OldWep"));
        DeletePVar(playerid, "OldWep");
    }
    return 1;
}
It set's player weapon to "fist" when he enters a vehicle AS A DRIVER and it changed back to what he has when he exits it (after being the driver).

EDIT: Calg00ne was faster -.-
Reply
#4

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
Why do you want that? - So that he can't shoot? Just do this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        SetPVarInt(playerid, "OldWep", GetPlayerWeapon(playerid);
        SetPlayerArmedWeaopn(playerid, 0);
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        SetPlayerArmedWeapon(playerid, GetPVarInt(playerid, "OldWep"));
        DeletePVar(playerid, "OldWep");
    }
    return 1;
}
It set's player weapon to "fist" when he enters a vehicle AS A DRIVER and it changed back to what he has when he exits it (after being the driver).

EDIT: Calg00ne was faster -.-
pawn Код:
SetPlayerArmedWeaopn(playerid, 0);
make it as

pawn Код:
SetPlayerArmedWeapon ( playerid , 0 ) ;
Reply
#5

Uh? Both statements are exactly the same. There's absolutely no need for all the additional spaces.
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
Uh? Both statements are exactly the same. There's absolutely no need for all the additional spaces.
Notice the original says 'Weaopn' instead of 'Weapon', but the additional spacing is just excessive and looks horrid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)