SA-MP Forums Archive
AttachTrailerToVehicl - 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: AttachTrailerToVehicl (/showthread.php?tid=288093)



AttachTrailerToVehicl - Azzeto - 06.10.2011

Hey, I need help with this, i'v looked on the wiki and it helped BUT. I need it so it'll attach a vehicle to whatever vehicle the player is in, please help ASAP.


Re: AttachTrailerToVehicl - Pharrel - 06.10.2011

pawn Код:
CMD:attachv(playerid,params[])
{
if(!strval(params[0])) return SendClientMessage(playerid, -1, "usage: /attachv [carid]");
AttachTrailerToVehicle(params[0],GetPlayerVehicleID(playerid));
return 1;
}
?


Re: AttachTrailerToVehicl - Azzeto - 06.10.2011

Hmm, Could you try explaining it so I could try to edit it to what I need? because I need it not in a command, I need it so when a player enters a checkpoint a certain (Id choose) would get attached to the back of their truck.


Re: AttachTrailerToVehicl - Pharrel - 06.10.2011

AttachTrailerToVehicle(car 1, car 2);

Car 2 = car that you drive

Car 1 = car that you take with you...


Re: AttachTrailerToVehicl - Azzeto - 06.10.2011

I know, but theres six vehicles the player is able to do the minimission with, how would it be? EX:
pawn Код:
if(Ccp[playerid] == 3)
    {
        new string[128];
        FreezeThenAutoUnfreeze(playerid,5000);
        DisablePlayerCheckpoint(playerid);
        Ccp[playerid] = 4;
        SetPlayerCheckpoint(playerid,2761.4836,-2455.6270,13.5552,3.0);
        format(string,sizeof(string),"HQ: HQ to %s, take this coal and bring it to LS docks.",GetName(playerid));
        SendClientMessage(playerid,COLOR_YELLOW,string);
        return 1;
    }
I want him to get a trailer attached with that.


Re: AttachTrailerToVehicl - Pharrel - 06.10.2011

checkpoint 1 = attach the vehicle to the car that you're drivin

checkpoint 2 = attach the 2nd vehicle to the car that you attached before...

checkpoint 3 = attach the 3th vehicle to the vehicle from 2nd checkpoint... and keep doing that

idk if is that what you need...


Re: AttachTrailerToVehicl - Azzeto - 06.10.2011

Nono, what I mean is HOW would I get thetrailer attached to the vehicle? (You helped me earlier, and I need the trailer attached to one of those six)
Scene: Driver drives to the checkpoint, gets froze for 5 seconds then gets a trailer attached to his vehicle(Either one of the six)


Re: AttachTrailerToVehicl - Pharrel - 06.10.2011

pawn Код:
new TrailerId[6] = {
{1st trailer id},
{2nd trailer id},
{3th trailer id},
{4th trailer id},
{5th trailer id},
{6th trailer id}
};

//onplayerentercheckpoint
TogglePlayerControllable(playerid, false);
SetTimerEx("AttachOneTrailer",5000,false,"i",playerid);

public AttachOneTrailer(playerid)
{
    AttachTrailerToVehicle(TrailerId[Random(random(sizeof(TrailerId))], GetPlayerVehicleID(playerid));//will attach one of those trailers randomly
    TogglePlayerControllable(playerid, true);
    //SendClientMessage
    return 1;
}
like this?


Re: AttachTrailerToVehicl - Azzeto - 06.10.2011

Thanks for all that but all I needed was
pawn Код:
AttachTrailerToVehicle(TrailerId[Random(random(sizeof(TrailerId))], GetPlayerVehicleID(playerid));//will attach one of those trailers randomly
Because I changed it to
pawn Код:
AttachTrailerToVehicle([ID of trailer], GetPlayerVehicleID(playerid));
So all I really needed was GetPlayerVehicleID(playerid)); :P


Re: AttachTrailerToVehicl - Pharrel - 06.10.2011

kkkkkk ok then ^^