Jump to content
  • 0

Dinamyc Work Trailer Spawn?


Duje Kenblock

Question

Question how can you make an example command /load trailer in that case spawnee a trailer either oil or also the normal samp many roleplay servers have that in jobs like truck distributor and that you just put /work or /load truck and you spawnea a trailer of gasoline or products dynamically and not have to go to the site to hook one for the roadtrain or another truck. 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
11 hours ago, Duje Kenblock said:

Question how can you make an example command /load trailer in that case spawnee a trailer either oil or also the normal samp many roleplay servers have that in jobs like truck distributor and that you just put /work or /load truck and you spawnea a trailer of gasoline or products dynamically and not have to go to the site to hook one for the roadtrain or another truck. 

get the model ID of the trailer and create it at player's vehicle position, and attach it to his vehicle with AttachTrailerToVehicle, but it needs to be called with a timer because the trailer will be not streamed too fast by the player.

 

createPlayerTrailer(playerid, trailerid) 
{
    new const vehicleid = GetPlayerVehicleID(playerid);

    if(!vehicleid) 
        return 0;

    new Float:x, Float:y, Float:z;
    GetVehiclePos(vehicleid, x, y, z);

    SetTimerEx("attachVehicleTrailer", 700, false, "dd", vehicleid, CreateVehicle(trailerid, x, y, z, 0.0, -1, -1, -1));
    return 1;
}


forward attachVehicleTrailer(vehicleid, trailerid);
public attachVehicleTrailer(vehicleid, trailerid) 
{
    return AttachTrailerToVehicle(vehicleid, trailerid);
}

Edited by Sancky
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.