AttachTrailerToVehicle problem
#1

Problem: I get this "Job: You have to collect products that have grown after you farmed the land. (( /jpick ))" message, but trailer isn't attached. Trailer changes it's rotation( Z-rotation) but it does not attach itself to the players car.
Trailer is next to vehicle( streamed )
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid,3.0,-3.9349,31.2148,3.0800))
    {
        if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 531)
            {
                AttachTrailerToVehicle(PlayerTrailer[playerid],GetPlayerVehicleID(playerid));
                SendClientMessage(playerid,COLOR_JOB,"Job: You have to collect products that have grown after you farmed the land. (( /jpick ))");
                DisablePlayerCheckpoint(playerid);
            }
        }
    }
    return 1;
}
code cut out from OnDialogResponse. Could be helpful.
pawn Код:
PlayerTrailer[playerid]=CreateVehicle(607, -1.9775,38.4117,3.0796,330.3404, 0, 0, -1);
SetPlayerCheckpoint(playerid,-3.9349,31.2148,3.0800,3.0);
I am not receiving any warnings or errors.

Please help. Thank you in advance!
Reply
#2

bump. Is is possible that player car is to "low" and that trailer is hooked only for a milisecond( even though it doesn't move from it's position , and isn't that close to players vehicle. It only changes rotation )?
Reply
#3

pawn Код:
new PlayerTrailer[MAX_PLAYERS] = 0;

public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, -3.9349, 31.2148, 3.0800))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vid = GetPlayerVehicleID(playerid);
            if(vid == 531)
            {
                AttachTrailerToVehicle(PlayerTrailer[playerid],vid);
                SendClientMessage(playerid,COLOR_JOB,"Job: You have to collect products that have grown after you farmed the land. (( /jpick ))");
                DisablePlayerCheckpoint(playerid);
            }
        }
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    /*-- Suas funзхes --*/
    DestroyVehicle(PlayerTrailer[playerid]);
    SetPlayerCheckpoint(playerid,-3.9349,31.2148,3.0800,3.0);
    PlayerTrailer[playerid] = CreateVehicle(607, -1.9775,38.4117,3.0796,330.3404, 0, 0, -1);    
    return 0;
}
Se ajudei da reputation ae
Reply
#4

THank you for your try. You did nothing special( added vid variable, and added DestroyVehicle function that i already had, but didn't post). Also you made a little mistake. Should look like:
if( GetVehicleModel(vid)==531).
But anyway. I think I dont lose if I give you rep for your try anyway.
I have tried a lot of options. Some other trailers can be hooked, some can't. I guess this is a SAMP bug, or it is made that trailer 607 can't be attached to tractor.
Reply
#5

eu tambйm acho que esse trailer nao pode se anexar a certos veiculos, mas voltando o assunto eu nao errei no
if(vid == 531)
OBS: eu uso assim, sempre ajudei assim e sempre funcionou, mas se eu ver outra soluзгo para seu problema eu posto aqui.
Reply
#6

okay. thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)