SA-MP Forums Archive
Why is this wrong ? - 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)
+--- Thread: Why is this wrong ? (/showthread.php?tid=484346)



Why is this wrong ? - Jhony_Blaze - 30.12.2013

Hello, I am trying to add a moving gate in a script but I keep getting some errors, I don't know how to fix them, this is how I tried to make the movable gate command:

Код:
CMD:bay1(playerid, params[]) {
    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2)
 //Line 8960      if(IsPlayerInRangeOfPoint(playerid, 10.0, -2212.2202,-2279.4954,30.6250)) switch(FDGates[0][1]) {
          case 0: {
             MoveDynamicObject(LSPDGates[1][0], -2213.0356, -2280.7808, 38.2505, 1.0);
   	         FDGates[0][1] = 1;
             SendClientMessage(playerid, COLOR_RED, "Bay 1 is open.");
	         return 1;
	         }
          case 1: {
             MoveDynamicObject(LSPDGates[1][0],-2213.0356, -2280.7808, 32.4608, 1.0);
             FDGates[0][1] = 0;
             SendClientMessage(playerid, COLOR_GREEN, "Bay 1 is closed.");
             }
		}
	}
	return 1;
}
Код:
new
	LSPDObjs[8][3], // 8 sets of doors. 0 = door1, 1 = door2, 2 = status (closed/open)
	LSPDGates[2][2]; // Boom gate, garage (1 = status, closed/open).
//Line 520	FDGates[2][2],
}
Errors!

Код:
C:\Documents and Settings\Attila\Desktop\aprp\gamemodes\vx-rp.pwn(520) : error 010: invalid function or declaration
C:\Documents and Settings\Attila\Desktop\aprp\gamemodes\vx-rp.pwn(8960) : error 017: undefined symbol "FDGates"
C:\Documents and Settings\Attila\Desktop\aprp\gamemodes\vx-rp.pwn(8960) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Attila\Desktop\aprp\gamemodes\vx-rp.pwn(8960) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Attila\Desktop\aprp\gamemodes\vx-rp.pwn(8960) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.



Re: Why is this wrong ? - Unri - 30.12.2013

Код:
new
	LSPDObjs[8][3], // 8 sets of doors. 0 = door1, 1 = door2, 2 = status (closed/open)
	LSPDGates[2][2]>>>>>>>>>>>>>>;<<<<<<<<<<<<<< // Boom gate, garage (1 = status, closed/open).
//Line 520	FDGates[2][2],
}
You have misplaced ';' It has to be closing the last value.

Код:
new LSPDObjs[8][3],
    LSPDGates[2][2],
    FDGates[2][2];



Re: Why is this wrong ? - Konstantinos - 30.12.2013

pawn Код:
// global: OUT of any callback.
new
    LSPDObjs[8][3],
    LSPDGates[2][2],
    FDGates[2][2];



Re: Why is this wrong ? - Jhony_Blaze - 30.12.2013

Thank YOU !


Re: Why is this wrong ? - Jhony_Blaze - 30.12.2013

Actually there is one more thing

Код:
C:\Documents and Settings\Attila\Desktop\aprp\gamemodes\vx-rp.pwn(8972) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
          }
          case 1: {
             MoveDynamicObject(LSPDGates[1][0],-2213.0356, -2280.7808, 32.4608, 1.0);
             FDGates[0][1] = 0;
             SendClientMessage(playerid, COLOR_GREEN, "Bay 1 is closed.");
			}
		}
	}
// Here is the problem	return 1;
}



Re: Why is this wrong ? - Jhony_Blaze - 30.12.2013

-------FIXED-------


Re: Why is this wrong ? - Konstantinos - 30.12.2013

pawn Код:
CMD:bay1(playerid, params[])
{
    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, -2212.2202,-2279.4954,30.6250))
        {
            switch(FDGates[0][1])
            {
                case 0:
                {
                    MoveDynamicObject(LSPDGates[1][0], -2213.0356, -2280.7808, 38.2505, 1.0);
                    FDGates[0][1] = 1;
                    SendClientMessage(playerid, COLOR_RED, "Bay 1 is open.");
                }
                case 1:
                {
                    MoveDynamicObject(LSPDGates[1][0],-2213.0356, -2280.7808, 32.4608, 1.0);
                    FDGates[0][1] = 0;
                    SendClientMessage(playerid, COLOR_GREEN, "Bay 1 is closed.");
                }
            }
        }
    }
    return 1;
}
EDIT: Too late, I didn't refresh the page.