SA-MP Forums Archive
Vehicle Destroying Problem - 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: Vehicle Destroying Problem (/showthread.php?tid=207457)



Vehicle Destroying Problem - [WF]Demon - 06.01.2011

well i have my cars in a FilterScript and i have it so it destroys the vehicles on exit. but i dont want it to destroy cars with people in them. i have tried

pawn Код:
public OnFilterScriptExit()
{
    for(new p = 0; p < 20; p++)
    {
        for(new i = 0; i < VEHICLES; i++)
        {
            if(!IsPlayerInVehicle(p, i))
            {
            DestroyVehicle(i);
            }
        }
    }
    return 1;
}
But it still takes away the cars for players.

Can someone please post a working code?

P.S. I Searched


Re: Vehicle Destroying Problem - Joe Staff - 06.01.2011

pawn Код:
public OnFilterScriptInit()
{
    for(new vehid;vehid<MAX_VEHICLES;vehid++)
    {
        if(!GetVehicleModel(vehid))continue;
        for(new playerid;playerid<MAX_PLAYERS;playerid++)
        {
            if(!IsPlayerConnected(playerid))continue;
            if(IsPlayerInVehicle(playerid,vehid))
            {
                playerid=-1;
                vehid++;
            }
        }
        DestroyVehicle(vehid);
    }
}



Re: Vehicle Destroying Problem - Jack Elliott - 06.01.2011

well i dont know about the original thread starter but it worked for me .... thanks