What's wrong with this?
#1

pawn Code:
CMD:gate(playerid, params[])
{
    if(GateClosed)
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
        {
            GateClosed = false;
            MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.00000000,0.00000000,88.00000000);
            return 1;
        }
    }
    else{
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
        {
            GateClosed = true;
            MoveObject(Gate,89.19999695,2501.50000000,17.89999962, 3.0, 00000000,0.00000000,88.00000000);
            return 1;
        }
    }
}
   
    if(GateClosed1){
    if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
    {
        GateClosed1 = false;
        MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
        return 1;
    }
       

        else{
            if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038)){
            GateClosed1 = true;
            MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
            return 1;
            }
    }
    return 1;
}
EDIT: I messed with the code a bit, and now I only got this Error.
Code:
C:\Users\Luke\Desktop\Scripting\gamemodes\urban.pwn(822) : error 030: compound statement not closed at the end of file (started at line 769)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 769 is
pawn Code:
if(GateClosed)
Reply
#2

U are using GateClosed not GateClosed1
Reply
#3

On line
pawn Code:
if(GateClosed)
You are not giving the statement something to compare to.
In your case it should be
pawn Code:
if(GateClosed ==  true)
Reply
#4

Your code is just a chaos.. I don't realize what each command is checking/doing at the moment. Tell what you want exactly, so i can re-build it...
Reply
#5

Try this, this should work. I see you wanted to make one gate command compatible with all the gates on your server.
You could use a little bit of practice.

pawn Code:
CMD:gate(playerid, params[])
{
    if(GateClosed == true)
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
        {
            GateClosed = false;
            MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.00000000,0.00000000,88.00000000);
            return 1;
        }
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
        {
            GateClosed = true;
            MoveObject(Gate,89.19999695,2501.50000000,17.89999962, 3.0, 00000000,0.00000000,88.00000000);
            return 1;
        }
    }
    if(GateClosed1 == true)
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
        {
            GateClosed1 = false;
            MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
            return 1;
        }
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
        {
            GateClosed1 = true;
            MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
            return 1;
        }
    }
    return 1;
}
Reply
#6

pawn Code:
CMD:gate(playerid, params[])
{
    if(GateClosed == true)
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
        {
            GateClosed = false;
            MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.00000000,0.00000000,88.00000000);
            return 1;
        }
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695, 2501.50000000, 17.89999962))
        {
            GateClosed = true;
            MoveObject(Gate,89.19999695,2501.50000000,17.89999962, 3.0, 00000000,0.00000000,88.00000000);
            return 1;
        }
    }
    if(GateClosed1 == true)
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
        {
            GateClosed1 = false;
            MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
            return 1;
        }
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
        {
            GateClosed1 = true;
            MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
            return 1;
        }
    }
    return 1;
}
Reply
#7

Sorry about the messy code, I'm still learning. I've edited my original one (Didn't copy and paste your guy's) and tried to make it more readable. How's this?
pawn Code:
CMD:gate(playerid, params[])
{
    if (gTeam[playerid] == TEAM_TE)
    {
        if(GateClosed ==  true)
        { //RED TEAM MAP2
            if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695,2501.50000000,17.89999962))
            {
                GateClosed = false;
                MoveObject(Gate, 89.40000153,2496.30004883,17.89999962, 3.0, 0.0, 0.0, 88.00000000);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "This is the Counter Terrorists gate!");
            }
        }
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 89.19999695,2501.50000000,17.89999962))
        {
            GateClosed = true;
            MoveObject(Gate, 89.19999695,2501.50000000,17.89999962, 3.0, 0.0, 0.0, 88.00000000);
            return 1;
        }
    }
    if (gTeam[playerid] == TEAM_CT) //BLUE TEAM MAP2
    {
        if(GateClosed1 ==  true)
        { //blue team map2
            if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
            {
                GateClosed1 = false;
                MoveObject(Gate1, 184.80000305, 2499.60009766, 18.10000038, 3.0, 0.0, 0.0, 270.00000000);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "This is the Terrorists gate!");
            }
        }
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 185.00000000, 2493.10009766, 18.10000038))
        {
            GateClosed1 = true;
            MoveObject(Gate1, 185.00000000, 2493.10009766, 18.10000038, 3.0, 0.0, 0.0, 269.99996948);
            return 1;
        }
    }
    return 1;
}
EDIT: Oh, and it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)