SA-MP Forums Archive
Everyone is an Admin Level 5 when they connect. - 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: Everyone is an Admin Level 5 when they connect. (/showthread.php?tid=518784)



Everyone is an Admin Level 5 when they connect. - Johnson_Brooks - 11.06.2014

Im using Y_INI to save the player stats (Info).
OnPlayerConnect
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
// The rest is dialogs , the other stats load normally , only the admin level is 5
dialog response
pawn Код:
for register:
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Username",MAX_PLAYER_NAME);
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteString(File, "Ip", IP);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Banned",0);
                INI_WriteInt(File,"BannedBy",0);
                INI_WriteInt(File,"BannedName",0);
                INI_WriteInt(File,"BannedFor",0);
                INI_Close(File);
Whats the problem?


Re: Everyone is an Admin Level 5 when they connect. - BleverCastard - 11.06.2014

Check if you're applying the admin level anywhere in your script.


Re: Everyone is an Admin Level 5 when they connect. - Rittik - 11.06.2014

Show your /makeadmin command.


Re: Everyone is an Admin Level 5 when they connect. - Stinged - 11.06.2014

It's probably because you are not resetting the variables.


Re: Everyone is an Admin Level 5 when they connect. - MBilal - 11.06.2014

hey dude here is Solution I m sure it will help !!
PHP код:
switch( dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_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");
                
Player[playerid][pAdmin] = 0// add this Line 
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Username",MAX_PLAYER_NAME);
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteString(File"Ip"IP);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_WriteInt(File,"Banned",0);
                
INI_WriteInt(File,"BannedBy",0);
                
INI_WriteInt(File,"BannedName",0);
                
INI_WriteInt(File,"BannedFor",0);
                
INI_Close(File); 



Re: Everyone is an Admin Level 5 when they connect. - BleverCastard - 11.06.2014

Quote:
Originally Posted by Rittik
Посмотреть сообщение
Show your /makeadmin command.
Erm, you need to learn to read: "Everyone is an Admin Level 5 when they connect."

Quote:
Originally Posted by Stinged
Посмотреть сообщение
It's probably because you are not resetting the variables.
This is registering. Their account isn't created yet, so what's there to reset?


Re: Everyone is an Admin Level 5 when they connect. - MBilal - 11.06.2014

he say every player which connect get admin level when every new player join he need to register so all admin level to Zero ,No budy can get that Only Rcon admin can give level .


Re: Everyone is an Admin Level 5 when they connect. - Stinged - 11.06.2014

The variable are linked to the playerid.

Let me give an example:
Let's say there was an admin level 5 with id 0 online, and that player left.
The admin variable that is linked to id 0 is still 5.
The next player to join and get id 0 will get the admin level that was linked to id 0, which is 5.

Just try to reset it under OnPlayerDisconnect, and tell me what happens.


Re: Everyone is an Admin Level 5 when they connect. - SAMProductions - 11.06.2014

Quote:
Originally Posted by Stinged
Посмотреть сообщение
The variable are linked to the playerid.

Let me give an example:
Let's say there was an admin level 5 with id 0 online, and that player left.
The admin variable that is linked to id 0 is still 5.
The next player to join and get id 0 will get the admin level that was linked to id 0, which is 5.

Just try to reset it under OnPlayerDisconnect, and tell me what happens.
Like Stinged said,
You should try to reset it under OnPlayerConnect or OnPlayerDisconnect Callback except the Password, Like for Example :-
pawn Код:
// Under OnPlayerConnect Callback
    pInfo[playerid][pAdmin] = 0;
    pInfo[playerid][Score] = 0;
    pInfo[playerid][Money] = 0;
    pInfo[playerid][Kills] = 0;
    pInfo[playerid][Deaths] = 0;

// Blah... Blah... Blah... The Rest of the Codes here.
// The stats/values/integers that have been saved will be loaded using the function called INI_ParseFile...
// You can set it inside the OnPlayerDisconnect Callback too...



Re: Everyone is an Admin Level 5 when they connect. - MBilal - 11.06.2014

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Like Stinged said,
You should try to reset it under OnPlayerConnect or OnPlayerDisconnect Callback except the Password, Like for Example :-
pawn Код:
// Under OnPlayerConnect Callback
    pInfo[playerid][pAdmin] = 0;
    pInfo[playerid][Score] = 0;
    pInfo[playerid][Money] = 0;
    pInfo[playerid][Kills] = 0;
    pInfo[playerid][Deaths] = 0;

// Blah... Blah... Blah... The Rest of the Codes here.
// The stats/values/integers that have been saved will be loaded using the function called INI_ParseFile...
// You can set it inside the OnPlayerDisconnect Callback too...
First putting this Under OnPlayerConnect and OnPlayerDisconnect Like this Not Help it make problem When you make your self admin in game And relog then on player COnnect it will set Your Level to Zero Same Problem On Player Disconnect