[Help] Anti-Driveby
#1

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);
        }
Reply
#2

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.
Reply
#3

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.
Reply
#4

Delete. I've figured everything out myself. woo! another + for me that other servers don't have
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)