06.01.2010, 19:03
http://pawn.pastebin.com/f4b4c5045
Try that. (didn't test)
Put the..
..on the top of the script.
When you TOW a car, Trailer[vehicleid] gets the car's ID, and when you press the button again, it checks if Trailer[vehicleid] equals to 0. If it does, script continues, otherwise it detaches the car, sets the Trailer[vehicleid] to 0 and returns 1 to stop the script from proceeding(without the return it will attach the same car again, since Trailer[vehicleid] is 0).
I'd also suggest to replace...
...with...
Try that. (didn't test)
Put the..
pawn Код:
new Trailer[MAX_VEHICLES] = 0;
When you TOW a car, Trailer[vehicleid] gets the car's ID, and when you press the button again, it checks if Trailer[vehicleid] equals to 0. If it does, script continues, otherwise it detaches the car, sets the Trailer[vehicleid] to 0 and returns 1 to stop the script from proceeding(without the return it will attach the same car again, since Trailer[vehicleid] is 0).
I'd also suggest to replace...
pawn Код:
if ((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
pawn Код:
if (IsPlayerInRangeOfPoint(playerid, 7.0, vX, vY, vZ) && vid != GetPlayerVehicleID(playerid))