SA-MP Forums Archive
Trailer issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Trailer issue (/showthread.php?tid=596315)



Trailer issue - TwinkiDaBoss - 15.12.2015

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


Re: Trailer issue - vassilis - 15.12.2015

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


Re: Trailer issue - TwinkiDaBoss - 15.12.2015

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


Re: Trailer issue - vassilis - 15.12.2015

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


Re: Trailer issue - TwinkiDaBoss - 15.12.2015

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


Re: Trailer issue - vassilis - 15.12.2015

I can't find anything wrong..!


Re: Trailer issue - nickdodd25 - 15.12.2015

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.


Re: Trailer issue - TwinkiDaBoss - 15.12.2015

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