SA-MP Forums Archive
Admin level problems - 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: Admin level problems (/showthread.php?tid=488688)



Admin level problems - MBilal - 18.01.2014

The Problem is when i set my admin level in game and any other player register or login in he get same Adminlevel
WTF how to Fix it ? its cmd thanks for help !!
Код:
CMD:setlevel(playerid,params[])
{
	new ID;
	new levels;
	new Nam[ MAX_PLAYER_NAME ];
	new pname[ MAX_PLAYER_NAME ];
	new str[128];
	if(IsPlayerAdmin(playerid)|| Player[playerid][pAdmin] >= 5)
	{
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setlevel [ID] [Level 1-10]");
    if(levels > 10) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-10!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF9900AA,"That user is not connected.");
    if(Player[ID][pAdmin] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has set your Admin level to %d on the server. ",Nam,levels);
        SendClientMessage(ID,0xFF9900AA,str);
        format(str, sizeof(str),"You have set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,0xFF9900AA,str);
        Player[ID][pAdmin] = levels;
        return 1;
    }
    format(str, sizeof(str),"%s has set your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    Player[ID][pAdmin] = levels;
	}
	else
	{
SendClientMessage(playerid, COLOR_ORANGE, "You Need to Rcon admin Or Higher Admin to use this Cmd");
	}
   	return 1;
}



Re: Admin level problems - Blademaster680 - 18.01.2014

I had this problem. When the player registers set their admin level there to 0.
Код:
Player[ID][pAdmin] = 0;
Put that under the register system for when they register


Re: Admin level problems - MBilal - 18.01.2014

I already have that but i dont know why it give admin level to other who register
Код:
switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
			    new INI:File = INI_Open(UserPath(playerid));
			    INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);