help with tow system -
Chris_Morrison - 09.02.2013
Hey
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;
}
Re: help with tow system -
iGamerX - 09.02.2013
Removed
Re: help with tow system -
Chris_Morrison - 09.02.2013
It's not the kind of a tow system i want
Re: help with tow system -
Blast3r - 09.02.2013
Код:
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(vehicleid))
{
DetachTrailerFromVehicle(vehicleid);
SendClientMessage(playerid, COLOR_GREY, "INFO:{FFFFFF} You stopped towing a vehicle");
return 1;
}
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;
}
Is that what you're looking for or want a new command like untow?
Re: help with tow system -
Chris_Morrison - 09.02.2013
May i have an /untow?
Re: help with tow system -
Blast3r - 09.02.2013
Код:
CMD:untow(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsTrailerAttachedToVehicle(vehicleid))
{
DetachTrailerFromVehicle(vehicleid);
SendClientMessage(playerid, COLOR_GREY, "INFO:{FFFFFF} You stopped towing a vehicle");
return 1;
}
return 1;
}
I didn't test it, but didn't give me any errors when I placed it in my script, so yeah, good luck.