09.02.2013, 17:29
Hey
This is my /tow system, how to make untow system?I don't know how to do it
my tow code:
This is my /tow system, how to make untow system?I don't know how to do it
my tow code:
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));
format(string, sizeof(string), "* %s starts towing a vehicle.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
}
if (!Found)
{
SendClientMessage(playerid,COLOR_GREY,"There is no vehicle in range.");
}
return 1;
}