if(strcmp(cmd, "/makeadmin", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "{00E6FF}UTILIZARE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]"); return 1; } new para1; new level; para1 = ReturnUser(tmp); tmp = strtok(cmdtext, idx); level = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 0 || IsPlayerAdmin(playerid)) { if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { GetPlayerName(para1, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); PlayerInfo[para1][pAdmin] = level; printf("AdmWarning: %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, 128, "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin.", sendername,giveplayer,level); ABroadCast(COLOR_YELLOW,string,5); } } } else { SendClientMessage(playerid, COLOR_GRAD1, "{09F7DF}DENIED: {ffffff}No access"); } } return 1; }
CMD:setlevel(playerid,params[]) { if(pInfo[playerid][pLevel] < 6 && !IsPlayerAdmin(playerid))return ShowMessage(playerid, COLOR_RED, 1); new id,level ,year,month,day,hour,minute,second; if(sscanf(params, "ui", id, level)) return SCM(playerid, 0xFFFF00C8, "[SYSTEM] : /Setlevel <PlayerID> <Level>") ; if(level < 0 || level > MaxAdminLevel) return SCM(playerid,-1,"Invalid level(level must be greater than -1)"); if(!IsPlayerConnected(id))return ShowMessage(playerid, COLOR_RED, 2); if(level == pInfo[id][pLevel]) return SCM(playerid,-1,"Player is already in this level!"); getdate(year, month, day); gettime(hour,minute,second); switch(level) { case 0: LevelName = "Player Status"; case 1: LevelName = ADMIN_LEVEL_1; case 2: LevelName = ADMIN_LEVEL_2; case 3: LevelName = ADMIN_LEVEL_4; case 4: LevelName = ADMIN_LEVEL_3; case 5: LevelName = ADMIN_LEVEL_5; case 6: LevelName = ADMIN_LEVEL_6; } format(Jstring,sizeof(Jstring),"You have given %s level: %d (%s) , Date: %d/%d/%d at %d:%d:%d",GetName(id), level, LevelName, day, month, year ,hour, minute, second); SCM(playerid,COLOR_BLUE,Jstring); if(level > pInfo[id][pLevel]) { format(Jstring,sizeof(Jstring),"Admin %s has given you Admin level: %d (%s) <Promoted on %d/%d/%d at %d:%d:%d>",GetName(playerid), level, LevelName ,day, month, year,hour, minute, second),GameTextForPlayerEx(id,"~B~congratulations!~N~~G~Promoted", 2000, 3); SCM(id,COLOR_AQUA,Jstring); } else { format(Jstring,sizeof(Jstring),"Admin %s has set you level: %d <Demoted on %d/%d/%d at %d:%d:%d>",GetName(playerid), level,day, month, year,hour, minute, second),GameTextForPlayerEx(id,"~R~Demoted", 2000, 3); SCM(id,COLOR_RED,Jstring); } pInfo[id][pLevel] = level; return 1; }
CMD:makeadmin(playerid, params[]) {
new
para1,
level;
if(sscanf(params, "ud", para1, level))
return SendClientMessage(playerid, COLOR_GRAD2, "{00E6FF}UTILIZARE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]");
else if(pInfo[playerid][pAdmin] < 1 || !IsPlayerAdmin(playerid))
return SendClientMessage(playerid, COLOR_GRAD1, "{09F7DF}DENIED: {ffffff}No access");
else if(!IsPlayerConnected(para1))
return 1;
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmWarning: %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, 128, "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin.", sendername,giveplayer,level);
ABroadCast(COLOR_YELLOW,string,5);
return 1;
}
CMD:makeadmin(playerid, params[])
{
if (!PlayerInfo[playerid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "{09F7DF}DENIED: {ffffff}No access");
new para1, level;
if (sscanf(params, "ri", para1, level)) return SendClientMessage(playerid, COLOR_GRAD2, "{00E6FF}UTILIZARE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]");
if (para1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid player");
if (!(1 <= level <= 1338)) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid level. It must be between 1 and 1338");
new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144];
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmWarning: %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, 128, "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin.", sendername, giveplayer, level);
ABroadCast(COLOR_YELLOW, string, 5);
return 1;
}
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo" C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : warning 215: expression has no effect C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : error 001: expected token: ";", but found "]" C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : error 029: invalid expression, assumed zero C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
CMD:makeadmin(playerid, params[]) { if (!PlayerInfo[playerid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{09F7DF}DENIED: {ffffff}No access"); new para1, level; if (sscanf(params, "ri", para1, level)) return SendClientMessage(playerid, -1, "{00E6FF}UTILIZARE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]"); if (para1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player"); if (!(1 <= level <= 1338)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1 and 1338"); new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144]; GetPlayerName(para1, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); PlayerInfo[para1][pAdmin] = level; printf("AdmWarning: %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, 128, "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin.", sendername, giveplayer, level); ABroadCast(COLOR_YELLOW, string, 5); return 1; }
if (!(1 <= level <= 1338)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1 and 1338");
if (!(1 <= level <= 1339)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1 and 1339");
^
Код:
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo" C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : warning 215: expression has no effect C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : error 001: expected token: ";", but found "]" C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : error 029: invalid expression, assumed zero C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(251) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |
Код:
if (!(1 <= level <= 1339)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1 and 1339"); |
if (!(1 <= level <= 4) && !(1337 <= level <= 1338)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1-4 and 1337-1338");