SA-MP Forums Archive
Why doesn't this only destroy the vehicles I tell it to? - 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: Why doesn't this only destroy the vehicles I tell it to? (/showthread.php?tid=90917)



Why doesn't this only destroy the vehicles I tell it to? - ThePS3Guy - 11.08.2009

Here is the pastebin

http://samp.pastebin.com/m2564cfd9

It should only explode the hunter, rhino and hydra if it leaves the boundaries, but it destroys ALL vehicles outside of the boundaries. Why?


Re: Why doesn't this only destroy the vehicles I tell it to? - Backwardsman97 - 11.08.2009

Like I said in the last post, I don't think that was proper syntax. I guess it wasn't.

pawn Код:
new CarID = GetVehicleModel(GetPlayerVehicleID(i));
if(CarID == 432 || CarID == 425 || CarID == 520)
Replace those lines.


Re: Why doesn't this only destroy the vehicles I tell it to? - ThePS3Guy - 11.08.2009

now it doesn't destroy any vehicle.. i think it might have something to do with new CarID = GetVehicleModel(GetPlayerVehicleID(i));
because isn't a vehicles id specific to that vehicle? not that vehicle type?


Re: Why doesn't this only destroy the vehicles I tell it to? - coole210 - 11.08.2009

Use DestroyVehicle(playerid,GetPlayerVehicleID(playeri d)); instead of SetVehicleHealth..


Re: Why doesn't this only destroy the vehicles I tell it to? - ThePS3Guy - 11.08.2009

Thanks coole for the help, but I would rather use SetVehicleHealth because instead of just deleting the vehicle, it blows it up, which is the effect I'm looking for


Re: Why doesn't this only destroy the vehicles I tell it to? - Backwardsman97 - 11.08.2009

pawn Код:
public WeaponsVehicleCheck()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerInArea(i,423.9233, 56.4679, 2138.4824, 1681.4557))
        {
            ResetPlayerWeapons(i);
            new CarID = GetVehicleModel(GetPlayerVehicleID(i));
            if(CarID == 432 || CarID == 425 || CarID == 520)
            {
                SetVehicleHealth(CarID,0.0);
            }
        }
    }
}
Try that.


Re: Why doesn't this only destroy the vehicles I tell it to? - coole210 - 11.08.2009

If it blows up, then it will respawn at hackers ( or some1 elses ) spawn point.


Re: Why doesn't this only destroy the vehicles I tell it to? - Backwardsman97 - 11.08.2009

This isn't to prevent hackers from spawning these. It is so that when someone leaves a deathmatch area I presume in one of these vehicles, it blows them up. It may be easier just to set world boundaries though.


Re: Why doesn't this only destroy the vehicles I tell it to? - Abernethy - 11.08.2009

Why not use SetVehicleToRespawn instead of destroying the vehicle?


Re: Why doesn't this only destroy the vehicles I tell it to? - ThePS3Guy - 11.08.2009

does anyone know why it's not working? i just dont understand why it isn't, it looks like it should. they just dont disappear when i leave the area.