[Help] Anti-Driveby - 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: [Help] Anti-Driveby (
/showthread.php?tid=248349)
[Help] Anti-Driveby -
Lars_Frederiksen - 13.04.2011
Howdy. Well since the stupid SetPlayerAmmo function isn't working I've managed to make somethimg simliar. Anyways when a player enters the car with a Tech 9, UZI, or MP5, it will set their ammo to -60 -30. Everything works great on this little system that I'm making. Everything accept for if I enter the car with another gun in my hand, then the function i made does not take effect..
For Example. If I have an MP5 in my hand, and I get into a car as the Driver. Then the ammo will get set to -60-30. But if I have an MP5 on me, and I enter the car with my fist, or a desert eagle, or another weapon in general. Then the function will not take effect.
Can anyone help me fix this? Or tell me why it isn't working how I want it to...?
pawn Код:
new gun = GetPlayerWeapon(playerid), ammo = 0-30;
if(gun == 28 || gun == 29 || gun == 32)
{
RemovePlayerWeapon(playerid, gun);
GivePlayerWeapon(playerid, gun, ammo);
}
Re: [Help] Anti-Driveby -
Mike Garber - 13.04.2011
Ofcourse it wont have any effect since you're making an if statement with only three weapons.
Now all weapons can be used as a driveby weapon, so do
pawn Код:
if(GetPlayerWeapon(playerid) != 0) SetPlayerArmedWeapon(playerid,0);
If you put this, in a timer, or on OnPlayerEnterVehicle, they wont be able to perform a driveby.
Re: [Help] Anti-Driveby -
JaTochNietDan - 13.04.2011
The SA-MP Wiki provides the answer to this
here. It's because the GetPlayerWeapon function only returns what the player is currently holding, not what he has in his inventory.
Re: [Help] Anti-Driveby -
Lars_Frederiksen - 13.04.2011
Delete. I've figured everything out myself. woo! another + for me that other servers don't have