SA-MP Forums Archive
/attachtrailer - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /attachtrailer (/showthread.php?tid=199359)



/attachtrailer - Deat_Itself - 15.12.2010

pawn Код:
dcmd_at(playerid,params[])  {
    new trailerid[256], interior, vehicle, Index, Float:X,Float:Y,Float:Z, car; trailerid = strtok(params,Index);
    GetPlayerPos(playerid, X,Y,Z);
    interior = GetPlayerInterior(playerid);
    if(!strlen(trailerid)) return SendClientMessage(playerid,red,"USAGE: /at [vehicleid 400-611/vehiclename]");
    if(!IsNumeric(trailerid)) car = GetVehicleModelIDFromName(trailerid); else car = strval(trailerid);
    if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
    vehicle = CreateVehicle(car, X+3,Y,Z, 130, 0, 1, -1); LinkVehicleToInterior(vehicle,interior);
    new getmodel = GetVehicleModel(vehicle);  //tried with GetPlayerVehicleID(vehicle);
    AttachTrailerToVehicle(getmodel, GetPlayerVehicleID(playerid));
    }
    return 1;
    }
Everything works fine.It teleports the vehicle aswell but after that it doenst attaches the vehicle!


Re: /attachtrailer - Elmin - 15.12.2010

Try:
AttachTrailerToVehicle(car, GetPlayerVehicleID(playerid));


Re: /attachtrailer - Deat_Itself - 15.12.2010

thanks for your help Elmin

btw it worked with the timer !