Admin Rank code! Error
#1

There is an error with this code:

if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [playerid/PartOfName] [Admin Rank]");
SendClientMessage(playerid, COLOR_YELLOW, "(0) Remove Admin Status");
SendClientMessage(playerid, COLOR_YELLOW, "(1) Moderator");
SendClientMessage(playerid, COLOR_YELLOW, "(2) Junior Admin");
SendClientMessage(playerid, COLOR_YELLOW, "(3) General Admin");
SendClientMessage(playerid, COLOR_YELLOW, "(4) Senior Admin");
SendClientMessage(playerid, COLOR_YELLOW, "(1337) Head Admin");
SendClientMessage(playerid, COLOR_YELLOW, "(133 Co-Community Owner");
SendClientMessage(playerid, COLOR_YELLOW, "(1339) Co-Community Owner");
SendClientMessage(playerid, COLOR_YELLOW, "(99999) Community Owner");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(PlayerInfo[playerid][pAdmin] >= 99999 || strcmp(sendername, "Callum_Riley", true) == 0)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("{AA3333}AdmCmd{FFFF00}: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}


This is the error message:

C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(547 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(549 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(552 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(564 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(568 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(571 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(573 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(575 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(588 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(593 ) : error 010: invalid function or declaration
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(595 ) : warning 203: symbol is never used: "level"
C:\Users\Gamer\Desktop\good\gamemodes\test.pwn(595 ) : warning 203: symbol is never used: "para1"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


10 Errors.


Can someone please fix it!
Reply
#2

Can you add PAWN tags to the code, makes it easier for people to understand it and then help you :P
Reply
#3

Using Hungarian Notation, code hasn't been tested because I don't have a copy of the NG-RP rip.

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new iTargetID, aLevel, szTargetName[MAX_PLAYER_NAME], szName[MAX_PLAYER_NAME], string[128];
    if(sscanf(params, "ii", iTargetID, aLevel)) SendClientMessage(playerid, COL_GREY, "USAGE: /makeadmin [playerid] [level]");
   
    GetPlayerName(playerid, szTargetName, sizeof(szTargetName));
    GetPlayerName(iTargetID, szName, sizeof(szName));
   
    if(PlayerInfo[playerid][pAdmin] < 99999) return SendClientMessage(playerid, -1, " You're not authorised to use this command!");
    if(iTargetID = INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, " That player isn't connected!");

    if(aLevel < 0 || > 99999) return SendClientMessage(playerid, -1, " You must specify an admin level between 0 and 99999.");
   
    PlayerInfo[iTargetID][pAdmin] = aLevel;
   
    printf("%s was promoted to %d level admin by %s", szName, aLevel, szTargetName);
    format(string, sizeof(string), " You have been promoted to a level %d admin by %s", aLevel, szName);
    SendClientMessage(playerid, -1, string);
    format(string, sizeof(string), " You have promoted %s to a level %d admin.", szTargetName, aLevel);
    SendClientMessage(playerid, -1, string);
   
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)