Lowe Admin lvls können höhere promoten?

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • dcmd_setlevel(playerid,params[])
    {
    if(AccInfo[playerid][LoggedIn] == 1)
    {
    if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
    new tmp [256];
    new tmp2[256];
    new Index;
    tmp = strtok(params,Index);
    tmp2 = strtok(params,Index);
    if(!strlen(params))
    {
    new string[128];
    format(string,sizeof(string),"Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
    SendClientMessage(playerid,LIGHTBLUE2,string);
    return SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
    }
    new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    player1 = strval(tmp);
    if(!strlen(tmp2)) return
    SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setlevel [PlayerID] [Level (0/5)]") &&
    SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
    level = strval(tmp2);


    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
    if(AccInfo[player1][LoggedIn] == 1)
    {
    if(level > ServerInfo[MaxAdminLevel])
    return SendClientMessage(playerid,red,"ERROR: Invalid Level");
    if(level == AccInfo[player1][Level])
    return SendClientMessage(playerid,red,"ERROR: Player is already this level");
    SendCommandToAdmins(playerid,"SetLevel");
    GetPlayerName(player1, playername, sizeof(playername));
    GetPlayerName(playerid, adminname, sizeof(adminname));
    new year,month,day;
    new hour,minute,second;
    getdate(year, month, day);
    gettime(hour,minute,second);


    if(level > 5)
    {
    AdmRank = "Professional Admin";
    }
    switch(level)
    {
    case 1: AdmRank = "Admin Level 2";
    case 2: AdmRank = "Moderator";
    case 3: AdmRank = "Master Moderator";
    case 4: AdmRank = "Administrator";
    case 5: AdmRank = "Master Administrator";
    }
    if(level > 0)
    format(string,sizeof(string),"|- Administrator %s has set you to Administrator Status | Level: %d - %s -|",adminname, level, AdmRank);
    else
    format(string,sizeof(string),"|- Administrator %s has set you to Player Status | Level: %d -|",adminname, level);
    SendClientMessage(player1,LIGHTBLUE,string);
    if(level > AccInfo[player1][Level])
    GameTextForPlayer(player1,"Promoted", 2000, 3);
    else GameTextForPlayer(player1,"Demoted", 2000, 3);


    format(string,sizeof(string),"You have given %s Level %d on '%d/%d/%d' at '%d:%d:%d'", playername, level, day, month, year, hour, minute, second);
    SendClientMessage(playerid,yellow,string);
    format(string,sizeof(string),"Administrator %s has made %s Level %d",adminname, playername, level);
    SaveIn("AdminLog",string);
    dUserSetINT(PlayerName2(player1)).("Level",(level));
    AccInfo[player1][Level] = level;
    return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
    }
    else return SendClientMessage(playerid,red,"ERROR: This player is not Registred or Logged!");
    }
    else return ErrorMessages(playerid, 2);
    }
    else return ErrorMessages(playerid, 1);
    }
    else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
    }


    Wie verbiete ich niedrigeren Admin Levels höhere Admin Levels zu promoten?

  • dcmd_setlevel(playerid,params[])
    {
    if(AccInfo[playerid][LoggedIn] == 1)
    {
    if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
    new tmp [256];
    new tmp2[256];
    new Index;
    tmp = strtok(params,Index);
    tmp2 = strtok(params,Index);
    if(!strlen(params))
    {
    new string[128];
    format(string,sizeof(string),"Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
    SendClientMessage(playerid,LIGHTBLUE2,string);
    return SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
    }
    new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    player1 = strval(tmp);
    if(!strlen(tmp2)) return
    SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setlevel [PlayerID] [Level (0/5)]") &&
    SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
    level = strval(tmp2);


    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
    if(AccInfo[player1][LoggedIn] == 1)
    {
    if(level > ServerInfo[MaxAdminLevel])
    return SendClientMessage(playerid,red,"** Admin has already this Level!");
    format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
    MessageToAdmins(yellow, string);
    if(level > AccInfo[playerid][Level]) return format(string,sizeof(string), "You can't use /setlevel on %s .", pName(playerid));
    SendClientMessage(playerid, yellow, string);


    Funktioniert nicht

  • Och Leute so schwer kann das doch nicht sein.


    Einfach die Adminabfragen mit deinen einbauen, fertig.
    if(playerid != pID)
    {
    if(SpielerInfo[pID][pAdminlevel] > SpielerInfo[playerid][pAdminlevel])return SCM(playerid,COLOR_GRAU,"Diesen Befehl darfst du bei dieser Person nicht benutzen.");
    }

  • dcmd_setlevel(playerid,params[])
    {
    if(AccInfo[playerid][LoggedIn] == 1)
    {
    if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
    new tmp [256];
    new tmp2[256];
    new Index;
    tmp = strtok(params,Index);
    tmp2 = strtok(params,Index);
    if(!strlen(params))
    {
    new string[128];
    format(string,sizeof(string),"Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
    SendClientMessage(playerid,LIGHTBLUE2,string);
    return SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
    }
    new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    player1 = strval(tmp);
    if(!strlen(tmp2)) return
    SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setlevel [PlayerID] [Level (0/5)]") &&
    SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
    level = strval(tmp2);


    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
    {
    if(AccInfo[player1][LoggedIn] == 1)
    {
    if(level > AccInfo[playerid][Level])
    {
    format(string,sizeof(string), "You can't use /setlevel on %s .", pName(player1));
    return SendClientMessage(playerid, yellow, string);
    }
    if(level > ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"** Admin has already this Level!");
    format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
    MessageToAdmins(yellow, string);



    Es muss natürlich vor die Nachricht an alle.



    @Shain™: Damit kann er sich ja noch immer selbst ein höheres Level geben, außerdem hat er es nur an der falschen Position eingefügt.

  • if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
    {
    if(AccInfo[player1][LoggedIn] == 1)
    {
    if(level > AccInfo[playerid][Level])
    {
    format(string,sizeof(string), "You can't use /setlevel on %s .", pName(player1));
    return SendClientMessage(playerid, yellow, string);
    }


    if(level > ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"** Admin has already this Level!"); // [(2452) : warning 217: loose indentation]
    format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
    MessageToAdmins(yellow, string);

    GetPlayerName(player1, playername, sizeof(playername));
    GetPlayerName(playerid, adminname, sizeof(adminname));
    new year,month,day;
    new hour,minute,second;
    getdate(year, month, day);
    gettime(hour,minute,second);


    Es ist doch alles richtig, wieso bekomme ich nen Error?

  • Das ist kein Error, sondern ein Warning..
    Du hast es nicht richtig eingerückt..
    Machs so:

    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
    {
    if(AccInfo[player1][LoggedIn] == 1)
    {
    if(level > AccInfo[playerid][Level])
    {
    format(string,sizeof(string), "You can't use /setlevel on %s .", pName(player1));
    return SendClientMessage(playerid, yellow, string);
    }


    if(level > ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"** Admin has already this Level!"); // [(2452) : warning 217: loose indentation]
    format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
    MessageToAdmins(yellow, string);


    GetPlayerName(player1, playername, sizeof(playername));
    GetPlayerName(playerid, adminname, sizeof(adminname));
    new year,month,day;
    new hour,minute,second;
    getdate(year, month, day);
    gettime(hour,minute,second);
    //hier dann dein weiterer Code

  • dcmd_setlevel(playerid,params[])
    {
    if(AccInfo[playerid][LoggedIn] == 1)
    {
    if(AccInfo[playerid][Level] >= 8 || IsPlayerAdmin(playerid))
    {
    new tmp [256];
    new tmp2[256];
    new Index;
    tmp = strtok(params,Index);
    tmp2 = strtok(params,Index);
    if(!strlen(params))
    {
    new string[128];
    format(string,sizeof(string),"** Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
    SendClientMessage(playerid,COLOR_WHITE,string);
    return SendClientMessage(playerid, COLOR_WHITE, "** This command is for higher Admin Levels only. You are not allowed to play with the /setlevel command. ");
    }
    new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    player1 = strval(tmp);
    if(!strlen(tmp2)) return
    SendClientMessage(playerid, COLOR_WHITE, "** Usage: /setlevel [PlayerID] [Level (0-10)]") &&
    SendClientMessage(playerid, COLOR_WHITE, "** This command is for higher Admin Levels only. You are not allowed to play with the /setlevel command. ");
    level = strval(tmp2);


    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
    {
    if(AccInfo[player1][LoggedIn] == 1)
    {
    if(level > AccInfo[playerid][Level])
    {
    format(string,sizeof(string), "You can't use /setlevel on %s as your Admin Level is the same or lower.", pName(player1));
    return SendClientMessage(playerid, yellow, string);
    }


    if(level > ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"** Admin has already this Level!");
    format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
    MessageToAdmins(yellow, string);

    GetPlayerName(player1, playername, sizeof(playername));
    GetPlayerName(playerid, adminname, sizeof(adminname));
    new year,month,day;
    new hour,minute,second;
    getdate(year, month, day);
    gettime(hour,minute,second);


    if(level > 5)
    {
    AdmRank = "Professional Admin";
    }
    switch(level)
    {
    case 1: AdmRank = "Admin Level 2";
    case 2: AdmRank = "Moderator";
    case 3: AdmRank = "Master Moderator";
    case 4: AdmRank = "Administrator";
    case 5: AdmRank = "Master Administrator";
    }
    if(level > 0)
    format(string,sizeof(string),"* Administrator %s has granted Admin Level %d to you.",adminname, level);
    else
    format(string,sizeof(string),"* Administrator %s has granted Player Status to you. You are Level %d now.",adminname, level);
    SendClientMessage(player1,yellow,string);
    if(level > AccInfo[player1][Level])
    GameTextForPlayer(player1,"~g~Congratulations!", 4000, 3);
    else GameTextForPlayer(player1,"~r~Demotion", 4000, 3);


    format(string,sizeof(string),"* Administrator %s has granted permanent Admin Level %s to %d.",adminname, level, playername);
    SaveIn("AdminLog",string);
    dUserSetINT(PlayerName2(player1)).("Level",(level));
    AccInfo[player1][Level] = level;
    return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
    }
    else return SendClientMessage(playerid,red,"** This player is not logged in or is not registred.");
    }
    else return ErrorMessages(playerid, 2);
    }
    else return ErrorMessages(playerid, 1);
    }
    else return SendClientMessage(playerid,red,"** You need to login before using commands.");
    }


    Admins mit niedrigem Level sollten keinen höheren Admin promoten oder demoten können. Man sollte auch nicht selber sein Level setzen können.


    Der code sollte eigentlich genau das tun, es funktioniert aber nicht. Ich kann immernoch höhere Admins zb lvl 10er mit lvl 8 demoten.

  • Ich kann als Level 8 aber Spieler auf Level 9 oder 10 promoten wenn sie unter level 8 sind.


    Ich möchte aber, dass ich als Level 8 nur bis Level 8 promoten kann, sowie als 9 nur bis Level 9, als 10 bis 10.