How to give a player weapon id 0?
#1

I use GivePlayerWeapon(playerid,0,0) and GivePlayerWeapon(playerid,0,1) and GivePlayerWeapon(playerid,0,-1) and none will work. I just don't want a player to use any SMG while driving a bike and i don't want to rest the weapons. Any way to do this?
Reply
#2

i think id 0 dont exists....
pawn Код:
GivePlayerWeapon(playerid,gun,ammo);
Reply
#3

Oh ok true. Well hmm. What can I do? Give them a camera with 1 ammo? XD
Reply
#4

Ah, you're looking to disable driveby I'm guessing?

Put this code under OnPlayerStateChange:

pawn Код:
if((newstate == PLAYER_STATE_DRIVER) || (newstate == PLAYER_STATE_PASSENGER))
    {
        for(new j=0; j<11; j++) GetPlayerWeaponData(playerid, j, Weapons[playerid][j], Ammo[playerid][j]);
        ResetPlayerWeapons(playerid);
        GameTextForPlayer(playerid,"~p~Drive-by ~w~is not ~r~allowed.~n~~w~Weapons ~r~temporarily ~w~disabled.", 3000, 3);
    }
    if((newstate == PLAYER_STATE_ONFOOT) && ((oldstate == PLAYER_STATE_DRIVER) || (oldstate == PLAYER_STATE_PASSENGER)))
    {
        for(new j=0; j<11; j++)    GivePlayerWeapon(playerid, Weapons[playerid][j], Ammo[playerid][j]);
    }
Ripped it out of my gamemode, enjoy.
Reply
#5

Weapon 0 is fist. You can't give player weapon fist, as the player will always have fist, no matter what.
Reply
#6

You can use SetPlayerArmedWeapon(playerid, 0);
Reply
#7

Thanks Alot Calg00ne. It worked I did not even consider that function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)