/Tow Command
#1

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.
Reply
#2

Can you point out which lines these are....
Reply
#3

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;
 }
Reply
#4

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;
}
Reply
#5

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

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!
Reply
#7

Bump comon guys please help me out?
Reply
#8

No one knows how to do this comon please?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)