03.12.2010, 10:58
Hello again ! I made a /tow command but i have a problem : when i tipe /tow it keeps getting the message : Attaching failed, the driver seat has to be clear, and the vehicle has to be used minimum once.
Here's the command
Here's the command
pawn Код:
if (strcmp(cmd, "/tow", true) ==0)
{
if(PlayerJob[playerid] == 2)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 525) // Towtruck
{
if(IsPlayerInAnyVehicle(playerid))
{
new playertryed = 0;
for(new i = 0; i <MAX_VEHICLES; i++)
{
new Float:x, Float:y, Float:z;
GetVehiclePos(i, x, y, z);
if(PlayerToPoint(5.0, playerid, x, y, z))
{
AttachTrailerToVehicle(i, GetPlayerVehicleID(playerid));
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
SendClientMessage(playerid, COLOR_YELLOW, "You have successfully towed this vehicle.");
SendClientMessage(playerid, COLOR_YELLOW, "Remember: vehicles can only be towed if there isn't any driver of it.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Attaching failed, the driver seat has to be clear, and the vehicle has to be used minimum once.");
}
return 1;
}
else
{
playertryed ++;
if(playertryed == 0){SendClientMessage(playerid, COLOR_RED, "You are not close to any vehicle. Try closer if you are.");}
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not a driver of this vehicle.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You must be in a towtruck to tow a player's vehicle.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Your job has to be a towtrucker to use this command.");
}
return 1;
}