01.10.2010, 01:14
pawn Код:
// samgreen: I believe it is dcmd practice to name this variable params
dcmd_tow(playerid, params[]) {
// If you use zcmd you will not have to suppress this warning.
#pragma unused params
new VID = GetPlayerVehicleID(playerid);
if(GetVehicleModel(VID) != 525) return SendClientMessage(playerid, COLOR_RED,"You have to be in a tow truck");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED,"You have to be the driver to tow a car.");
new Float:vX,Float:vY,Float:vZ;
for(new c = 0; c < MAX_VEHICLES; c++)
{
GetVehiclePos(c, vX, vY, vZ);
if(IsPlayerInRangeOfPoint(playerid, 20.0, vX, vY, vZ) && c != VID)
{
AttachTrailerToVehicle(c, VID);
SendClientMessage(playerid, COLOR_RED,"You have succesfully attached a vehicle!");
break;
}
}
}