SA-MP Forums Archive
brackets error... - 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: brackets error... (/showthread.php?tid=338039)



brackets error... - Gooday - 28.04.2012

pawn Код:
if (strcmp("/enter", cmdtext, true, 10) == 0)
    if(IsPlayerInRangeOfPoint(playerid, 7.0, -207.19999695,1119.19995117,20.10000038)
    {
    SetPlayerPos(playerid, -2158.80004883,642.90002441,1052.00000000);
    SetPlayerInterior(playerid, 1);
    GameTextForPlayer(playerid,"~b~DMV ~w~Office", 3000, 4);
    return 1;
    }
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    if(IsPlayerInRangeOfPoint(playerid, 7.0, -2158.80004883,642.90002441,1052.00000000)
    {
    SetPlayerPos(playerid, -207.19999695,1119.19995117,20.10000038);
    SetPlayerInterior(playerid, 0);
    return 1;
    }
    return 0;
}
Quote:

C:\Users\Luca\Desktop\BaseNorton V2\gamemodes\license.pwn(85) : error 001: expected token: ")", but found "{"
C:\Users\Luca\Desktop\BaseNorton V2\gamemodes\license.pwn(93) : error 001: expected token: ")", but found "{"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

How to fix please?


Re: brackets error... - iggy1 - 28.04.2012

first line :
pawn Код:
if (strcmp("/enter", cmdtext, true, 10) == 0) {
Second line:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 7.0, -207.19999695,1119.19995117,20.10000038) )
Swap these for yours.

EDIT: I just noticed your other range check is missing a closing bracket ')' too.

EDIT2: There's more wrong ill edit your code now.


Re: brackets error... - Gooday - 28.04.2012

thanks!


Re: brackets error... - iggy1 - 28.04.2012

Proper indentation will help avoid these errors.

pawn Код:
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, -207.19999695,1119.19995117,20.10000038) )
    {
        SetPlayerPos(playerid, -2158.80004883,642.90002441,1052.00000000);
        SetPlayerInterior(playerid, 1);
        GameTextForPlayer(playerid,"~b~DMV ~w~Office", 3000, 4);
        return 1;
    }
   
}
else if (strcmp("/exit", cmdtext, true, 10) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, -2158.80004883,642.90002441,1052.00000000) )
    {
        SetPlayerPos(playerid, -207.19999695,1119.19995117,20.10000038);
        SetPlayerInterior(playerid, 0);
        return 1;
    }
}
That should be inside OnPlayerCommandText. In your version the "/exit" command will never be executed since its inside the "/enter" command.