SA-MP Forums Archive
/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: /Tow Command (/showthread.php?tid=246110)



/Tow Command - Tommy_Mandaz - 03.04.2011

Hey guys please help me out with this command:

pawn Код:
if(strcmp(cmd,"/towcar",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
            {
                if(GetVehicleModel(525))
                {
                    if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                    {
                        DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
                    }
                }
                else
                {
                    AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));

                }
                else(Line 16997)
                {
                    if(!GetVehicleModel(525))
                {
                    SendClientMessage(playerid, COLOR_RED, "You are not in a tow truck");
                }
                else(Line 17003)
                {
                    if(!(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                (Line 17003)
                    SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command");
                }
            }
        }
    }
    }
    }
I get this error:

Код:
VGRP.pwn(16997) : error 029: invalid expression, assumed zero
VGRP.pwn(17003) : warning 217: loose indentation
VGRP.pwn(17006) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: /Tow Command - [UG]Scripter - 03.04.2011

Can you point out which lines these are....


Respuesta: /Tow Command - Daniel-92 - 03.04.2011

there have
pawn Код:
if(strcmp(cmd,"/towcar",true)==0)
 {
    if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
     {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
         {
            if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
             {
                DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
             }
            else
             {
                AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
             }
          }
        else
         {
            SendClientMessage(playerid, COLOR_RED, "You are not in a tow truck");
         }
     }
    else
     {
        SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command");
     }
    return 1;
 }



Re: /Tow Command - HyperZ - 03.04.2011

pawn Код:
if(strcmp(cmd,"/towcar",true)==0)
{
    if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 525) {
            if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) {
                DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
            }
            else {
                AttachTrailerToVehicle(GetPlayerVehicleID(playerid),GetPlayerVehicleID(playerid));
            }
        }
        else {
            SendClientMessage(playerid, -1, "You are not in a tow truck");
        }
    }
    else {
        SendClientMessage(playerid, -1, "You are not authorized to use this command");
    }
    return 1;
}



Re: /Tow Command - Tommy_Mandaz - 03.04.2011

Thanks so much, but how can I make it check if the person is near the vehicle he is trying to tow? Thanks.


Re: /Tow Command - Tommy_Mandaz - 03.04.2011

Bump, also can some tell me how come when I type /towcar near another car it isnt towing the vehicle? And please let me know how I can make it work so if the person is near a car they can tow it. Thanks!


Re: /Tow Command - Tommy_Mandaz - 03.04.2011

Bump comon guys please help me out?


Re: /Tow Command - Tommy_Mandaz - 03.04.2011

No one knows how to do this comon please?