Trailer issue
#1

Alright so the issue is quite simple, trailer wont attach to a tractor

PHP код:
CMD:attach(playerid,params[]) {
    
#pragma unused params
    
new vid GetPlayerVehicleID(playerid);
    new 
Float:Pos[3];
    
GetVehiclePos(vid,Pos[0],Pos[1],Pos[2]);
    
    
Tractor_Trailer[vid] = CreateVehicle(607,Pos[0],Pos[1],Pos[2]-5,0,0,0,0,0);
    
    
AttachTrailerToVehicle(Tractor_Trailer[vid], vid);
    
VehicleHaySlot[vid] = 0;
    return 
true;

It creates the trailer, but it doesnt attach it onto the vehicle
Reply
#2

PHP код:
 AttachTrailerToVehicle(vidTractor_Trailer[vid]); 
I think it is vice versa.
EDIT:My bad let me check again.
Reply
#3

Quote:
Originally Posted by vassilis
Посмотреть сообщение
PHP код:
 AttachTrailerToVehicle(vidTractor_Trailer[vid]); 
I think it is vice versa.
EDIT:My bad let me check again.
Yeah, its vice versa.
I even tried setting up a timer to let the trailer to be loaded and shit but still doesnt work
Reply
#4

This will only work if both vehicles are streamed in for a player.
Have you stream both vehicles for a player?
if no IsVehicleStreamedIn
Reply
#5

Quote:
Originally Posted by vassilis
Посмотреть сообщение
This will only work if both vehicles are streamed in for a player.
Have you stream both vehicles for a player?
if no IsVehicleStreamedIn
Yeah I do, thats why Im spawning the trailer so close to player, so its streams in etc. I tried with having a timer with it to let them stream in properly but still no results at all
Reply
#6

I can't find anything wrong..!
Reply
#7

I had a similar issue a while back, i ended up using OnVehicleStreamIn (https://sampwiki.blast.hk/wiki/OnVehicleStreamIn) and attaching the trailer to the vehicle when the trailer streams in. Seemed to work quire reliably for my needs.
Reply
#8

Quote:
Originally Posted by nickdodd25
Посмотреть сообщение
I had a similar issue a while back, i ended up using OnVehicleStreamIn (https://sampwiki.blast.hk/wiki/OnVehicleStreamIn) and attaching the trailer to the vehicle when the trailer streams in. Seemed to work quire reliably for my needs.
Will try something like that, I thought of it but I might just end of scrapping the system entirely for now, thanks for letting me know
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)