How to give a player weapon id 0? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to give a player weapon id 0? (
/showthread.php?tid=235674)
How to give a player weapon id 0? -
Tee - 06.03.2011
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?
Re: How to give a player weapon id 0? -
Marricio - 06.03.2011
i think id 0 dont exists....
pawn Код:
GivePlayerWeapon(playerid,gun,ammo);
Re: How to give a player weapon id 0? -
Tee - 06.03.2011
Oh ok true. Well hmm. What can I do? Give them a camera with 1 ammo? XD
Re: How to give a player weapon id 0? -
grand.Theft.Otto - 06.03.2011
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.
Re: How to give a player weapon id 0? -
admantis - 06.03.2011
Weapon 0 is fist. You can't give player weapon fist, as the player will always have fist, no matter what.
Re: How to give a player weapon id 0? -
Calgon - 06.03.2011
You can use SetPlayerArmedWeapon(playerid, 0);
Re: How to give a player weapon id 0? -
Tee - 07.03.2011
Thanks Alot Calg00ne. It worked I did not even consider that function.