Help 1 error
#1

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

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

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!");
Reply
#4

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

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

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

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

EDIT: Late Reply

You forgot to put a ; in the last return.
Reply
#9

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

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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)