Vehicle trailers
#1

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

Hope you can help me. Thank you.
Reply
#2

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

https://sampwiki.blast.hk/wiki/AttachTrailerToVehicle
Reply
#3

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;
    }
Reply
#4

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.
Reply
#5

Oh, ill try that, thanks.

How can i see wehicle ids?
Reply
#6

Here.
Reply
#7

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.
Reply
#8

like line one is id 1?
Reply
#9

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

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..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)