Trailer Respawn
#1

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
Reply
#2

pawn Код:
new veh = GetPlayerVehicleID(playerid);
new Trailer = GetVehicleTrailer(veh);

if(Trailer > 0)
    SetVehicleToRespawn(Trailer);
Reply
#3

Tnx dude it work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)