SA-MP Forums Archive
Why is everybody admin? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why is everybody admin? (/showthread.php?tid=277972)



Why is everybody admin? - Admigo - 20.08.2011

Heey guys,
I made my own INI saving system.
I watched on my server and saw that everybody was admin.
Whats wrong with this:
Code:
enum pInfo
{
    pAdmin

}
forward LoadUser_AccountData(playerid,name[],value[]);
public LoadUser_AccountData(playerid,name[],value[])
{
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    return 1;
}
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));
                new plrIP[16];
                INI_SetTag(File,"AccountData");
                INI_WriteString(File,"Name",name);
		INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Admin",0);
                INI_Close(File);

                DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
			}
        }



Re: Why is everybody admin? - Kingunit - 20.08.2011

I hope for you that it isn't all your code. ..


Re: Why is everybody admin? - Admigo - 20.08.2011

lol no i have more then this:P But i delete the admin and make just a command for being admin:P


Re: Why is everybody admin? - Kush - 20.08.2011

Show the rest.


Re: Why is everybody admin? - =WoR=G4M3Ov3r - 20.08.2011

Give Details.


AW: Why is everybody admin? - Gomma - 20.08.2011

You need to reset the variable pAdmin, for example at OnPlayerConnect. Otherwise every player will have the variable of that player before.

So you were Admin, a other player came, and was also Admin etc...

Example:
pawn Code:
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][pAdmin] = 0;
return 1;
}



Re: AW: Why is everybody admin? - Admigo - 20.08.2011

Quote:
Originally Posted by Gomma
View Post
You need to reset the variable pAdmin, for example at OnPlayerConnect. Otherwise every player will have the variable of that player before.

So you were Admin, a other player came, and was also Admin etc...

Example:
pawn Code:
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][pAdmin] = 0;
return 1;
}
Thats my problem


Re: Why is everybody admin? - PhoenixB - 20.08.2011

Look around abouts OnPlayerConnect, something there is setting the player to Administrator. Show us coding please.


Re: Why is everybody admin? - Admigo - 20.08.2011

I just follow this: https://sampforum.blast.hk/showthread.php?tid=273088


Re: Why is everybody admin? - PhoenixB - 20.08.2011

And your registration system is exactly like Kush's version without you editing anything yes?


Re: Why is everybody admin? - Admigo - 20.08.2011

forward LoadUser_AccountData(playerid,name[],value[]);
public LoadUser_AccountData(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Banned",PlayerInfo[playerid][banned]);
INI_Int("Warnings",PlayerInfo[playerid][Warnings]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Captures",PlayerInfo[playerid][pCaptures]);
INI_Int("Rank",ranklvl[playerid]);
return 1;
}
I can only make admins with change the numbers of account not ingame/


Re: Why is everybody admin? - PhoenixB - 20.08.2011

You have to create the Makeadmin command in your script. You will need scripting knowledge for that.


Re: Why is everybody admin? - Admigo - 20.08.2011

I dont made that command yet:P I added admin commands with if(playerinfo[playerid][pAdmin]==5)


Re: Why is everybody admin? - PhoenixB - 20.08.2011

Well then if you want to make a player INGAME and not only via Scriptfiles, you should make one


Re: Why is everybody admin? - Admigo - 20.08.2011

I Deleted the admin save. I just need to rcon login for admin but is that save?


Re: Why is everybody admin? - PhoenixB - 20.08.2011

RCON administrator is on a whole different scale to Ingame Administrator as Ingame is a rank of somesort whereas RCON controlls the server entirely.