CMD:oadmin(playerid, params[]) { new targetname[24], filestring[79], level; if (PlayerInfo[playerid][pAdmin] < 7) return 0; if(level < 0 || level > 7) return SendClientMessage(playerid, red, "Error: Invailed Admin Level!"); if(sscanf(params, "s[24]d", targetname, level)) return SendClientMessage(playerid, COLOR_WHITE, "Correct Usage: /oadmin [name] [level]"); format(filestring, sizeof(filestring), "/PG/Accounts/%s.ini", targetname); if(!fexist(filestring)) return SendClientMessage(playerid, red, "Error: Incorrect Account!"); else { new INI:File = INI_Open(filestring); INI_SetTag(File, "data"); INI_WriteInt(File, "Admin", level); INI_Close(File); new done[128]; format(done, sizeof(done), "You have set %s admin level to %d", targetname, level); SendClientMessage(playerid, COLOR_YELLOW, done); } return 1; }
if(PlayerInfo[playerid][pAdmin] == level) return SendClientMessage(playerid,-1,"This player already in this level
What the... What do u mean i need a code like
Код:
if(PlayerInfo[playerid][pAdmin] == level) return SendClientMessage(playerid,-1,"This player already in this level |
new lvl;
INI_ParseFile(filestring, “lvlcheck”); Then put this somewhere else Forward lvlcheck(); Public lvlcheck() { INI_Int("Admin",lvl); }
forward Admin_data(name[], value[]); public Admin_data(name[], value[]) { INI_Int("Admin",lvl); return 1; } CMD:oadmin(playerid, params[]) { new targetname[24], filestring[79], level; if (PlayerInfo[playerid][pAdmin] < 7) return 0; if(level < 0 || level > 7) return SendClientMessage(playerid, red, "Error: Invailed Admin Level!"); if(sscanf(params, "s[24]d", targetname, level)) return SendClientMessage(playerid, COLOR_WHITE, "Correct Usage: /oadmin [name] [level]"); format(filestring, sizeof(filestring), "/PG/Accounts/%s.ini", targetname); if(!fexist(filestring)) return SendClientMessage(playerid, red, "Error: Incorrect Account!"); else { INI_ParseFile(filestring, "Admin_%s"); if(lvl == level) return SendClientMessage(playerid,red,"Error: The player already in this level"); new INI:File = INI_Open(filestring); INI_SetTag(File, "data"); INI_WriteInt(File, "Admin", level); INI_Close(File); new done[128]; format(done, sizeof(done), "You have set %s admin level to %d", targetname, level); SendClientMessage(playerid, COLOR_YELLOW, done); } return 1; }
Make a global var called
Код:
new lvl; Код:
INI_ParseFile(filestring, “lvlcheck”); Then put this somewhere else Forward lvlcheck(); Public lvlcheck() { INI_Int("Admin",lvl); } if(lvl >=.......bla bla bla) There might be small type errors becuz im in phone i hate |
No, please don't do this.
Simply get the player's admin level from the file and see whether it's equal to the level you're putting or not. |