SA-MP Forums Archive
i have problem with respawn all cars - 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: i have problem with respawn all cars (/showthread.php?tid=437446)



i have problem with respawn all cars - dash5487 - 15.05.2013

hi i use this code and it will respawn all car and npc car

can it be done like respawn all car exeept for npc if the driver and he is in car ?

Код:
dcmd_respawn(playerid,params[])
{
	#pragma unused params
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
         SetVehicleToRespawn(i);
        }

    return 1;
}



Re: i have problem with respawn all cars - Goldilox - 15.05.2013

Try this, I am assuming you can change it to dcmd.

pawn Код:
CMD:vrespawn(playerid, params[])
{
    if(GetAdminLevel(playerid) >= 2)
     {
        new bool:unwanted[MAX_VEHICLES];
        for(new player=0; player<MAX_PLAYERS; player++)
        {
            if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
        }
        for(new i = 1; i <MAX_VEHICLES; i++)
        {
            if(!unwanted[i]) SetVehicleToRespawn(i);
        }
        SendClientMessage(playerid, COLOR_TEAL, "All currently unused vehicles have been respawned.");
    }
    else return 0;
    return 1;
}
Please rep+ if helped!