SA-MP Forums Archive
[HELP] Tow command! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Tow command! (/showthread.php?tid=195625)



[HELP] Tow command! - [Aka]Dragonu - 03.12.2010

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
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;
    }



Re: [HELP] Tow command! - willsuckformoney - 03.12.2010

pawn Код:
else
                            {
                                SendClientMessage(playerid, COLOR_RED, "Attaching failed, the driver seat has to be clear, and the vehicle has to be used minimum once.");
                            }
Remove that.


Re: [HELP] Tow command! - [Aka]Dragonu - 03.12.2010

Lol i am too tired i think . Thank you . Problem solved !