SA-MP Forums Archive
Vehicle trailers - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Vehicle trailers (/showthread.php?tid=233789)



Vehicle trailers - sim_sima - 02.03.2011

Hello guys. How do i make tractor able to use the plow as trailer?

Hope you can help me. Thank you.


Re: Vehicle trailers - JaTochNietDan - 02.03.2011

See the use of AttachTrailerToVehicle on the SA-MP Wiki:

https://sampwiki.blast.hk/wiki/AttachTrailerToVehicle


Re: Vehicle trailers - sim_sima - 02.03.2011

Doesnt quite work. I did like this:
pawn Код:
if (strcmp("/trailer", cmdtext, true, 10) == 0)
    {
        pVehicle = GetPlayerVehicleID(playerid);
        if(pVehicle == 531)
        {
            AttachTrailerToVehicle(610, 531);
        }
        return 1;
    }



Re: Vehicle trailers - JaTochNietDan - 02.03.2011

Are you aware that AttachTrailerToVehicle works with vehicleids and not model ids? Also I'm not sure this if statement makes sense either, why are you checking if the ID of the vehicle is 531? Is that a special ID or something? Maybe you want to check if the model of the vehicle is 531? For example:

pawn Код:
if (strcmp("/trailer", cmdtext, true, 10) == 0)
{
    pVehicle = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(pVehicle) == 531)
    {
        AttachTrailerToVehicle(pVehicle, 531);
    }
    return 1;
}
You're also going to need to change the "531" parameter in the AttachTrailerToVehicle function to the actual vehicleid you want to attach, not the model of it.


- sim_sima - 02.03.2011

Oh, ill try that, thanks.

How can i see wehicle ids?


Re: Vehicle trailers - Unknown123 - 02.03.2011

Here.


Re: Vehicle trailers - Lorrden - 02.03.2011

Depends on how You've added you're Vehicles, You could create a Loop containing a 3dText which is displayed above the vehicle, send a message every time a player enters the vehicle or simply edit the Plate with a loop..


Or my personal favourite... Count the lines.
Endingline - Starting line

ex: 200 - 150 means you have 50 vehicles. simple.


Re: Vehicle trailers - sim_sima - 02.03.2011

like line one is id 1?


Re: Vehicle trailers - JaTochNietDan - 02.03.2011

Quote:
Originally Posted by Unknown123
Посмотреть сообщение
Again those aren't related to vehicle ID's, those are in fact model ID's.


Re: Vehicle trailers - Lorrden - 02.03.2011

Quote:
Originally Posted by AlExAlExAlEx
Посмотреть сообщение
Plate of car = Car id ? hmm that sounds interesting, can you dezvolt that idea a bit ?
Like okay, i know how to loop, but setting plate by vehicleid to every vehicle its own id..not

Simple version: (Untested but it should work in theory)
pawn Код:
for(new v = 1; v < MAX_VEHICLES; v ++)
{
    SetVehicleNumberPlate(v, v);
}
EDIT: Might not work since it's suposed to be a string..
But adding something like
pawn Код:
new string[3];
format(string, sizeof(string), "%d", v);
SetVehicleNumberPlate(v, string);
should work..