SA-MP Forums Archive
[HELP] respawn - 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: [HELP] respawn (/showthread.php?tid=514973)



[HELP] respawn - Luca12 - 24.05.2014

Hello. How can I make in this code that when I respawn all vehicles I want not to respawn trailers if you know what I mean?


pawn Код:
new bool:unwanted[CAR_AMOUNT];
    for(new player=0; player<MAX_PLAYERS; player++)
    {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
    }
    for(new car = 1; car < CAR_AMOUNT; car++)
    {
        if(!unwanted[car] && GetVehicleModel(car) != 584) SetVehicleToRespawn(car);
    }



Re: [HELP] respawn - MattTucker - 24.05.2014

pawn Код:
for(new car = 1; car < CAR_AMOUNT; car++)
    {
        if(!unwanted[car] && GetVehicleModel(car) != 584 && GetVehicleModel(car) != 435 && GetVehicleModel(car) != 591) SetVehicleToRespawn(car);
    }
This should work.. Though didn't test it.


Re: [HELP] respawn - Luca12 - 24.05.2014

It's set this in the first place in my code and I was make resspawn and with vehicles trailers also respawned. That code won't work. Thanks for replying


Re: [HELP] respawn - MasonSFW - 24.05.2014

Try this

define RespawnTime "2000" //You can change time to respawn vehicles here!

Quote:

public RespawnVehicles()
{
for(new c = 0; c < MAX_VEHICLES; c++)
{
if(c != INVALID_VEHICLE_ID)
{
if(IsVehicleEmpty©) SetVehicleToRespawn©;
}
}
return 1;
}

Quote:
public OnGameModeInit()
{
SetTimer("RespawnVehicles", RespawnTime, 1);
return 1;
}




Re: [HELP] respawn - Luca12 - 24.05.2014

Quote:
Originally Posted by MattTucker
Посмотреть сообщение
pawn Код:
for(new car = 1; car < CAR_AMOUNT; car++)
    {
        if(!unwanted[car] && GetVehicleModel(car) != 584 && GetVehicleModel(car) != 435 && GetVehicleModel(car) != 591) SetVehicleToRespawn(car);
    }
This should work.. Though didn't test it.
Thanks mate I was trying something like tht and for me it wasn't working, and I was put your code and it workin I make respawn all vehicles and the trailers didn't respawn. Thanks again.