Trailers respawning.
#1

Hello.

I am in middle of a personal project of scripting a server from scratch, I've made factions and what not and the first job I'm making is trucking. I'm well into it, however I'd like the trailer to despawn as I deliver the truck. At the moment this happens:
[ame]http://www.youtube.com/watch?v=9Yl782Ayfbk[/ame]

Is there a way to get the trailer despawned aswell?

This is my current code:

pawn Code:
if(truckloaded[playerid] == 2 && CPT[playerid] == 3)
        {
            SendClientMessage(playerid, COLOR_GREEN, "You've returned the truck. You got a skill point and $50 extra.");
            PlayerInfo[playerid][pCash] += 50;
            PlayerInfo[playerid][pTruckerSkill] += 1;
            truckloaded[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            CPT[playerid] = 0;
            new vehicleid = GetPlayerVehicleID(playerid);
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
            if(IsATruck(vehicleid)) SetVehicleToRespawn(vehicleid);
            }
            return 1;
            }
Reply
#2

You have to make a variable for a trailer while making it and then destroy it...
pawn Code:
new Trailer;
Trailer = AddStaticVehicle(....)
DestroyVehicle(Trailer);
EDIT: if you have many trailers then make it like this :
pawn Code:
new Trailer[HOWMUCHYOUHAVEINTOTAL];
Trailer[0] = AddStaticVehicle(....)
Trailer[1] = AddStaticVehicle(....)
Reply
#3

I thought about that, but how does the script know which trailer to destroy?
Reply
#4

Or just:
pawn Code:
new trailer = GetVehicleTrailer(GetPlayerVehicleID(playerid));
SetVehicleToRespawn(trailer);
Guess this is better option than his.
Reply
#5

Quote:
Originally Posted by ddnbb
View Post
Or just:
pawn Code:
new trailer = GetVehicleTrailer(GetPlayerVehicleID(playerid));
SetVehicleToRespawn(trailer);
Guess this is better option than his.
Yep. Thanks for sharing that , i didn't remember that. reped ya for refreshing it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)