Please Help
#1

I do not attach farm trailer to tractor.

Код HTML:
CMD:tri(playerid, params[])
{
	new trailerid = CreateVehicle(610, 0.00, 0.00, 0.00, 0.00, 0, 0, -1);
	AttachTrailerToVehicle(trailerid, GetPlayerVehicleID(playerid));
	return 1;
}
Reply
#2

Quote:
Originally Posted by norton2
Посмотреть сообщение
I do not attach farm trailer to tractor.

Код HTML:
CMD:tri(playerid, params[])
{
	new trailerid = CreateVehicle(610, 0.00, 0.00, 0.00, 0.00, 0, 0, -1);
	AttachTrailerToVehicle(trailerid, GetPlayerVehicleID(playerid));
	return 1;
}
this will only work if you're at the "zero" point of the map when you type the cmd.
AttachTrailerToVehicle will...
Quote:
Originally Posted by wikisamp
[...] only work if both vehicles are streamed in for a player [...]
so you have to create the trailer at your position instead of somewhere else.
use GetPlayerPos and some floats
Reply
#3

I did not understand, I can give you example how would need to show?

Thank You
Reply
#4

Quote:
Originally Posted by norton2
Посмотреть сообщение
I did not understand, I can give you example how would need to show?

Thank You
you have to create the trailer at the same position as the player (or at least somewhere near by).

try it like this:
pawn Код:
CMD:tri(playerid, params[])
{
    new Float:p[3];
    GetPlayerPos(playerid,p[0],p[1],p[2]);
    new trailerid = CreateVehicle(610, p[0],p[1],p[2], 0.00, 0, 0, -1);
    AttachTrailerToVehicle(trailerid, GetPlayerVehicleID(playerid));
    return 1;
}
or

pawn Код:
CMD:tri(playerid, params[])
{
    new trailerid = CreateVehicle(610, 0, 0, 0, 0.00, 0, 0, -1);
    if(!(IsVehicleStreamedIn(trailerid, playerid)))
    {
        new Float:p[3];
        GetPlayerPos(playerid,p[0],p[1],p[2]);
        SetVehiclePos(trailerid, p[0], p[1], p[2]);
    }
    AttachTrailerToVehicle(trailerid, GetPlayerVehicleID(playerid));
    return 1;
}
like this, you won't have to get the position of the player and create it near him
if he happens to be just near the "zero" point.
if not, it's just being created there and then tp'ed to him.
it'll get attached at the end.

either way, both examples will result in the trailer getting attached successfully
Reply
#5

not working! Farm trailer attach it on me.
IMAGE:
Reply
#6

bumb
Reply
#7

weird.
i ran some test and it seems like its getting streamed in too slow.
we can't create it and then instantly attach it.

something like this will work, i used it for testing:
pawn Код:
new trailerid;

YCMD:tractor(playerid,params[],help)
{
    new Float:x[3];
    GetPlayerPos(playerid,x[0],x[1],x[2]);
    CreateVehicle(531,x[0]+2,x[1]+2,x[2]+0.5,0,1,1,-1);
    return 1;
}

YCMD:trailer(playerid,params[],help)
{
    new Float:x[3];
    GetPlayerPos(playerid,x[0],x[1],x[2]);
    trailerid = CreateVehicle(610,x[0]+2,x[1]+2,x[2]+0.5,0,1,1,-1);
    return 1;
}

YCMD:attach(playerid,params[],help)
{
    if(IsVehicleStreamedIn(trailerid, playerid))
        AttachTrailerToVehicle(trailerid, GetPlayerVehicleID(playerid));
    else
        SendClientMessage(playerid,-1,"Trailer not streamed in!");
    return 1;
}
what you could do now is a cmd that runs a range check
to see if there are some trailers near by.
if there are, attach the nearest and done.
Reply
#8

Hehe.. If you dont set the position the it act as 0 cordinates.
Its bleberry acress.
Reply
#9

Thank you very much man!

+1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)