drive by weapon - 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)
+--- Thread: drive by weapon (
/showthread.php?tid=412052)
drive by weapon -
sscarface - 31.01.2013
can u tell me or give me link any tut how to made player can't use ak47 on drive pessenger seat
Re: drive by weapon -
tyler12 - 31.01.2013
pawn Код:
new PlayerWeapon[MAX_PLAYERS][13];
new PlayerAmmo[MAX_PLAYERS][13];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
for (new i = 0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerWeapon[playerid][i], PlayerAmmo[playerid][i]);
}
ResetPlayerWeapons(playerid);
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
for(new i=0;i<13;i++)
{
GivePlayerWeapon(playerid,PlayerWeapon[playerid][i],PlayerAmmo[playerid][i]);
}
}
return 1;
}
Re: drive by weapon -
Virus. - 31.01.2013
save his weapons, take weapons from him and give him cak when he gets out of the vehicle.
Re: drive by weapon -
sscarface - 31.01.2013
Quote:
Originally Posted by tyler12
pawn Код:
new PlayerWeapon[MAX_PLAYERS][13]; new PlayerAmmo[MAX_PLAYERS][13];
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { for (new i = 0; i<13; i++) { GetPlayerWeaponData(playerid, i, PlayerWeapon[playerid][i], PlayerAmmo[playerid][i]); } ResetPlayerWeapons(playerid); } if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) { for(new i=0;i<13;i++) { GivePlayerWeapon(playerid,PlayerWeapon[playerid][i],PlayerAmmo[playerid][i]); } } return 1; }
|
there is reset and i dnt want reset just some hidden weapons
Re: drive by weapon -
tyler12 - 31.01.2013
Quote:
Originally Posted by sscarface
there is reset and i dnt want reset just some hidden weapons
|
When the player exits the vehicle, the weapons will be gave back. Other than that, I don't know a way around it.
Re: drive by weapon -
sscarface - 31.01.2013
Quote:
Originally Posted by tyler12
When the player exits the vehicle, the weapons will be gave back. Other than that, I don't know a way around it.
|
but i want when player enter on pessenger seat they can use mp5 and pistol and 9mm only 3
Re: drive by weapon -
Gamer_Z - 31.01.2013
Quote:
Originally Posted by sscarface
but i want when player enter on pessenger seat they can use mp5 and pistol and 9mm only 3
|
pawn Код:
if(GetPlayerWeapon(playerid) == <id of AK>)SetPlayerArmedWeapon(playerid,0);
you can do that when a player is in a car.
else like other people suggest, save the weapons when a player enters a car, remove all of them and only gie mp5 etc.. all allowed weapons. then when a player exist, restore them checking how much ammo they got left.