04.08.2012, 18:04
Hello. How do i enable Tow Truck in multiplayer? When i try tow it's not working.
if (strcmp("/tow", cmdtext, true, 10) == 0) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 0; new vehicleid = GetPlayerVehicleID(playerid); if(IsTrailerAttachedToVehicle(vehicleid)) { DetachTrailerFromVehicle(vehicleid); return 1; } new Float:x, Float:y, Float:z; new Float:dist, Float:closedist=8, closestveh; for(new i=1; i < MAX_VEHICLES; i++) { if(i != vehicleid && GetVehiclePos(i, x, y, z)) { dist = GetPlayerDistanceFromPoint(playerid, x, y, z); if(dist < closedist) { closedist = dist; closestveh = i; } } } if(!closestveh) return 1; AttachTrailerToVehicle(closestveh, vehicleid); return 1; }