Trailer 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: Trailer Respawn (
/showthread.php?tid=525167)
Trailer Respawn -
Psyhophatic - 10.07.2014
Hello everyone !
I have a question about trailers... How can i respawn them without respawn-ing all cars ?
I have tried some codes but it respawn only the truck...
pawn Код:
case 21:
{
new Float:vhp;
new veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh,vhp);
if(vhp > 650)
{
if(!IsTrailerAttachedToVehicle(veh))
{
SendClientMessage(playerid,COLOR_YELLOW,"[D.M.V]: You must have the trailer attached to pass the exam !");
RemovePlayerFromVehicle(playerid);
DisablePlayerRaceCheckpoint(playerid);
ct[playerid] = 0;
}
else
{
ct[playerid] = 0;
RemovePlayerFromVehicle(playerid);
DisablePlayerRaceCheckpoint(playerid);
if(GetVehicleTrailer(veh)){ SetVehicleToRespawn(veh); }
SetVehicleToRespawn(veh);
PlayerInfo[playerid][pLicC] = 1;
SendClientMessage(playerid,COLOR_YELLOW,"[D.M.V]: Congratulations, you have aquired your driving license ©.");
if(PlayerInfo[playerid][pBankAcc] == 1 && PlayerInfo[playerid][pBank] >= 5000)
{
SendClientMessage(playerid,COLOR_YELLOW,"Your driving test was paid from your bank account !");
PlayerInfo[playerid][pBank] -= 5000;
}
else if(PlayerInfo[playerid][pCash] > 5000)
{
SendClientMessage(playerid,COLOR_YELLOW,"You have passed your driving test and you've paid the instructor 5000$.");
new oldcash= GetPlayerMoney(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,oldcash-5000);
}
}
}
else
{
ct[playerid] = 0;
RemovePlayerFromVehicle(playerid);
DisablePlayerRaceCheckpoint(playerid);
SetVehicleToRespawn(veh);
if(GetVehicleTrailer(veh)){ SetVehicleToRespawn(veh); }
SendClientMessage(playerid,COLOR_YELLOW,"[D.M.V]: You failed to take the driving license (A) because you wrecked the bike !");
}
}
The code above it's from my DMV system.
If anyone got any ideeas I am glad to hear
Re: Trailer Respawn -
Jefff - 10.07.2014
pawn Код:
new veh = GetPlayerVehicleID(playerid);
new Trailer = GetVehicleTrailer(veh);
if(Trailer > 0)
SetVehicleToRespawn(Trailer);
Re: Trailer Respawn -
Psyhophatic - 10.07.2014
Tnx dude it work