30.09.2010, 13:41
Hello,
I try to make a code that makes possible to tow other cars with a towtruck, Only this piece of code dont work, whats wrong with it?:
NOTE: I know that there's a filterscript that does this, but i want to make it myself.
I try to make a code that makes possible to tow other cars with a towtruck, Only this piece of code dont work, whats wrong with it?:
Код:
dcmd_tow(playerid, cmdtext[]) { #pragma unused cmdtext new VID = GetPlayerVehicleID(playerid); if(GetVehicleModel(VID) != 525) { SendClientMessage(playerid, COLOR_RED,"You have to be in a towtruck to tow a car."); return 1; } if(GetPlayerVehicleSeat(playerid) != 0) { SendClientMessage(playerid, COLOR_RED,"You have to be the driver to tow a car."); return 1; } new Float:vX,Float:vY,Float:vZ; new towtruckdriver = playerid; for(new c = 0; c < MAX_VEHICLES; c++) { GetVehiclePos(c, vX, vY, vZ); if(IsPlayerInRangeOfPoint(towtruckdriver, 20.0, vX, vY, vZ)) { AttachTrailerToVehicle(c, VID); SendClientMessage(towtruckdriver, COLOR_RED,"You have succesfully attached a vehicle!"); return 1; } else { SendClientMessage(towtruckdriver,COLOR_RED,"There is no towable vehicle in range."); return 1; } } }