SA-MP Forums Archive
Server Administrator Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server Administrator Problem (/showthread.php?tid=586617)



Server Administrator Problem - Jigsaw123 - 23.08.2015

Hey guys!

I have this problem, everything on my server works fine, however, when I make one of the players administrators, then all the players who register after that are administrators aswell :/

Anyone know how to solve it ?

If you need any part of the code, just ask.

Thank you!


Re: Server Administrator Problem - Logofero - 23.08.2015

Quote:
Originally Posted by Jigsaw123
Посмотреть сообщение
Hey guys!

I have this problem, everything on my server works fine, however, when I make one of the players administrators, then all the players who register after that are administrators aswell :/

Anyone know how to solve it ?

If you need any part of the code, just ask.

Thank you!
To help you need to put a code snippet


Re: Server Administrator Problem - Abagail - 23.08.2015

If you are using a MySQL query either you forgot to specify a WHERE column or the string size for the query string isn't big enough & is cutting it off.

If you aren't using a query, show the code you are using for setting administrators.


Re: Server Administrator Problem - Jigsaw123 - 23.08.2015

Quote:

CMD:makeadmin(playerid, params[])
{
new targetid, level;
new string[128];
if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid,COLOR_RED,"{AF1C1C}(INFO):{FFFFFF}Onl y Executive Administators can use this command. ");
else if (sscanf(params, "ui", targetid, level)) return SCM(playerid, COLOR_WHITE,"{E5AC00}Usage: {FFFFFF}/makeadmin [ID] [Level 1-6]");
else if(targetid == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED, "{B3B3B3}Player is not online");
else
{
format(string, sizeof(string),"{37A63D}(INFO){FFFFFF}You made %s Admin level %i!", PlayerName(targetid), level);
SCM(playerid, COLOR_WHITE, string);
format(string, sizeof(string),"{37A63D}(INFO){FFFFFF}You have been promoted to Level %i Admin by Executive Adminstrator %s ", level, PlayerName(playerid));
SCM(targetid, COLOR_WHITE, string);
PlayerInfo[targetid][pAdmin] = level;
format(string, sizeof(string),"{37A63D}(INFO){FFFFFF}Executive Adminstrator %s promoted %s to Admin Level %i | ",PlayerName(playerid),PlayerName(targetid),level) ;
AdminMessage(COLOR_WHITE, string);
SavePlayer(targetid);
}
return 1;
}

This is the code to make an administrator :P


Re: Server Administrator Problem - MartinSwag - 23.08.2015

Quote:
Originally Posted by Jigsaw123
Посмотреть сообщение
This is the code to make an administrator :P
You might want to post the SavePlayer function


Re: Server Administrator Problem - Logofero - 24.08.2015

Quote:
Originally Posted by Jigsaw123
Посмотреть сообщение
This is the code to make an administrator :P
PHP код:
CMD:makeadmin(playeridparams[])
{
    new 
targetidlevel;
    new 
string[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid,COLOR_RED,"{AF1C1C}(INFO):{FFFFFF}Onl y Executive Administators can use this command. ");
    else if (
sscanf(params"ui"targetidlevel)) return SCM(playeridCOLOR_WHITE,"{E5AC00}Usage: {FFFFFF}/makeadmin [ID] [Level 1-6]");
    else if(
targetid == INVALID_PLAYER_ID) return SCM(playeridCOLOR_RED"{B3B3B3}Player is not online");
    else
    {
        
format(stringsizeof(string),"{37A63D}(INFO){FFFFFF}You made %s Admin level %i!"PlayerName(targetid), level);
        
SCM(playeridCOLOR_WHITEstring);
        
format(stringsizeof(string),"{37A63D}(INFO){FFFFFF}You have been promoted to Level %i Admin by Executive Adminstrator %s "levelPlayerName(playerid));
        
SCM(targetidCOLOR_WHITEstring);
        
PlayerInfo[targetid][pAdmin] = level;
        
format(stringsizeof(string),"{37A63D}(INFO){FFFFFF}Executive Adminstrator %s promoted %s to Admin Level %i | ",PlayerName(playerid),PlayerName(targetid),level) ;
        
AdminMessage(COLOR_WHITEstring);
        
SavePlayer(targetid);
    }
    return 
1;

public 
OnPlayerDisconnect(playeridreason
{
    
// You forgot to reset the level when a player is disconnected from the server. On this when someone enters a given ID it receives administrator rights.
    
PlayerInfo[playerid][pAdmin] = 0// Reset level for player ID
    
return 1;




Re: Server Administrator Problem - SecretBoss - 24.08.2015

Quote:
Originally Posted by Logofero
Посмотреть сообщение
PHP код:
CMD:makeadmin(playeridparams[])
{
    new 
targetidlevel;
    new 
string[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid,COLOR_RED,"{AF1C1C}(INFO):{FFFFFF}Onl y Executive Administators can use this command. ");
    else if (
sscanf(params"ui"targetidlevel)) return SCM(playeridCOLOR_WHITE,"{E5AC00}Usage: {FFFFFF}/makeadmin [ID] [Level 1-6]");
    else if(
targetid == INVALID_PLAYER_ID) return SCM(playeridCOLOR_RED"{B3B3B3}Player is not online");
    else
    {
        
format(stringsizeof(string),"{37A63D}(INFO){FFFFFF}You made %s Admin level %i!"PlayerName(targetid), level);
        
SCM(playeridCOLOR_WHITEstring);
        
format(stringsizeof(string),"{37A63D}(INFO){FFFFFF}You have been promoted to Level %i Admin by Executive Adminstrator %s "levelPlayerName(playerid));
        
SCM(targetidCOLOR_WHITEstring);
        
PlayerInfo[targetid][pAdmin] = level;
        
format(stringsizeof(string),"{37A63D}(INFO){FFFFFF}Executive Adminstrator %s promoted %s to Admin Level %i | ",PlayerName(playerid),PlayerName(targetid),level) ;
        
AdminMessage(COLOR_WHITEstring);
        
SavePlayer(targetid);
    }
    return 
1;

public 
OnPlayerDisconnect(playeridreason
{
    
// You forgot to reset the level when a player is disconnected from the server. On this when someone enters a given ID it receives administrator rights.
    
PlayerInfo[playerid][pAdmin] = 0// Reset level for player ID
    
return 1;

This will also sets admin's level to 0 and admin level wont save, please post your saving code