SA-MP Forums Archive
Help 1 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help 1 error (/showthread.php?tid=278542)



Help 1 error - Jafet_Macario - 22.08.2011

Hello, until now I was working with strcmp and decided to go on zcmd, I created my first command but I'm gettin' an error and a warning.
pawn Code:
CMD:makeadmin(playerid, params[])
{
    new pID,  value;
    if(!PlayerInfo[playerid][pAdmin] == 1338) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not the OWNER!");
    else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
    else if (pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
    else
    {
        new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        GetPlayerName(pID, tName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
        SendClientMessage(pID, -1, string);
        PlayerInfo[pID][pAdmin] = value;
    }
    return 1
}
(213) : warning 213: tag mismatch on this line:
pawn Code:
if(!PlayerInfo[playerid][pAdmin] == 1338) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not the OWNER!");
(228 ) : error 001: expected token: ";", but found "}" on this line:
pawn Code:
}
If anyone can help me, please.


Re: Help 1 error - Adil - 22.08.2011

pawn Code:
if(!PlayerInfo[playerid][pAdmin] == 1338) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not the OWNER!"));



Re: Help 1 error - Dragony92 - 22.08.2011

Quote:
Originally Posted by Adil
View Post
pawn Code:
if(!PlayerInfo[playerid][pAdmin] == 1338) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not the OWNER!"));
What are you closeing with second bracket? :/

Code:
if(PlayerInfo[playerid][pAdmin] != 1338) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not the OWNER!");



Re: Help 1 error - Jafet_Macario - 22.08.2011

Ok, now I'm getting only this:
Code:
(228) : error 001: expected token: ";", but found "}"
228 =
pawn Code:
}
Anyone please?


Re: Help 1 error - Adil - 22.08.2011

Quote:
Originally Posted by Dragony92
View Post
What are you closeing with second bracket? :/
I'm sorry, I just misread that.


Re: Help 1 error - Jafet_Macario - 22.08.2011

If I go like this on the end:
pawn Code:
;}
It compiles fine... but it makes no sense?


Re: Help 1 error - Jafet_Macario - 22.08.2011

Sorry for bump, I'm dumb ^^ just found out now, instead of
pawn Code:
return 1
pawn Code:
return 1;
Thanks guys, problem solved.


Re: Help 1 error - Adil - 22.08.2011

EDIT: Late Reply

You forgot to put a ; in the last return.


Re: Help 1 error - =WoR=G4M3Ov3r - 22.08.2011

Quote:
Originally Posted by Jafet_Macario
View Post
Sorry for bump, I'm dumb ^^ just found out now, instead of
pawn Code:
return 1
pawn Code:
return 1;
Thanks guys, problem solved.
Ofc, it should have a ";" in the end.

Are you kidding me with everyone reading your cmd:makeadmin and didn't know that the problem was ";" in the end of "return", Lmfao.


Re: Help 1 error - Kush - 22.08.2011

PHP Code:
CMD:makeadmin(playeridparams[])
{
    new 
id,  value;
    if(!
PlayerInfo[playerid][pAdmin] == 1338) return SendClientMessage(playerid0xFF0000AA"ERROR: You are not the OWNER!");
    else if (
sscanf(params"ui"idvalue)) return SendClientMessage(playerid0xFF0000AA"Usage: /makeadmin [playerid/partofname] [level 1-1338]");
    else if (
id == INVALID_PLAYER_ID) return SendClientMessage(playerid0xFF0000AA"Player not found");
    new 
pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
GetPlayerName(idtNameMAX_PLAYER_NAME);
    
format(stringsizeof(string), "You have promoted %s to Admin level %i"tNamevalue);
    
SendClientMessage(playerid, -1string);
    
format(stringsizeof(string), "You have been promoted to Admin level %i by %s"valuepName);
    
SendClientMessage(id, -1string);
    
PlayerInfo[id][pAdmin] = value;
    return 
1