16.06.2013, 17:21
I don't knwo the untow scripts, but here's my tow scripts
pawn Код:
CMD:tow(playerid, params[])
{
// new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if (!IsATowTruck(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You are not in a tow truck.");
if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) SendClientMessage(playerid, COLOR_GREY, "You are already towing a vehicle.");
new Float:PPPX,Float:PPPY,Float:PPPZ;
GetPlayerPos(playerid,PPPX,PPPY,PPPZ);
new Float:VVVX,Float:VVVY,Float:VVVZ;
new Found=0;
new vid=0;
while((vid<MAX_VEHICLES)&&(!Found))
{
vid++;
GetVehiclePos(vid,VVVX,VVVY,VVVZ);
if ((floatabs(PPPX-VVVX)<7.0)&&(floatabs(PPPY-VVVY)<7.0)&&(floatabs(PPPZ-VVVZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
{
Found=1;
AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
}
}
if (!Found)
{
SendClientMessage(playerid,COLOR_GREY,"There is no vehicle in range.");
}
return 1;
}