08.02.2018, 20:30
solved it with this:
PHP код:
SetTimerEx("AttachTrailer", 1000, 0, "i", playerid);
PHP код:
function AttachTrailer(playerid)
{
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
new Float:vX, Float:vY, Float:vZ;
GetVehiclePos(TrailerID[playerid],vX,vY,vZ);
if((floatabs(pX-vX)<100.0)&&(floatabs(pY-vY)<100.0)&&(floatabs(pZ-vZ)<100.0)&&(TrailerID[playerid]!=GetPlayerVehicleID(playerid))) AttachTrailerToVehicle(TrailerID[playerid],GetPlayerVehicleID(playerid));
return 1;
}