[Help] - Registered = Admin
#1

Whenever someone registered in my server, they get admin level for free. They also got my Stats.

Let me clear it,
Whenever someone registered, they've got my stats. They're the same like my stats.

I'm using WP_Hash and Y_INI Registration/Login System.

Here's the tutorial link that i've used: https://sampforum.blast.hk/showthread.php?tid=352703.
It's usually written by newbienoob.

Thanks in advance
Reply
#2

BUMP [Next: 48 Hours]
Reply
#3

Show me your register dialog code.
Reply
#4

Here :-
pawn Код:
if(dialogid == prregister)
    {//then
        if(!response) return Kick(playerid);
        if(response)
        {//then
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,prregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 1;
            }
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Player's Data");
            INI_WriteString(file,"Password",hashpass);
            INI_WriteInt(file,"Status",0);
            INI_WriteInt(file,"Donator",0);
            INI_WriteInt(file,"Cash",0);
            INI_WriteInt(file,"Scores",0);
            INI_WriteInt(file,"Kills",0);
            INI_WriteInt(file,"Deaths",0);
            INI_Close(file);
            SendClientMessage(playerid,-1,"You have been successfully registered");/
            return 1;
        }
    }
Reply
#5

Hm, nothing wrong in that.
Can you please show me your OnPlayerDisconnect and OnPlayerConnect?
Reply
#6

pawn Код:
new LoadDatabase[MAX_PLAYERS];

forward AccessDatabase(playerid);
public AccessDatabase(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    if(fexist(Path(playerid)))
    {
        new pRLoginMSG[750];
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        format(pRLoginMSG, sizeof(pRLoginMSG), "Welcome back %s, Please Login", pName);
        ShowPlayerDialog(playerid, prlogin, DIALOG_STYLE_PASSWORD,"{FF0000}>> {00C8FF}Account Login{FFFFFF}:", pRLoginMSG, "Login", "Leave");
    }
        else
    {
        new pRRegMSG[750];
        format(pRRegMSG, sizeof(pRRegMSG), "Welcome back %s, Please Register", pName);
        ShowPlayerDialog(playerid, prregister, DIALOG_STYLE_PASSWORD, "{FF0000}>> {00C8FF}Account Registration{FFFFFF}:", pRRegMSG, "Register", "Leave");
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    LoadDatabase[playerid] = 1;
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if(LoadDatabase[playerid]==1)
    {
        SetPlayerSkin(playerid, pInfo[playerid][pRSkin]);
        SetWeather(1);
        SetWorldTime(0);
        SetPlayerCameraPos(playerid, 1481.000, -1779.000, 157.000);
        SetPlayerCameraLookAt(playerid,1481.000, -1788.000, 155.000);
        AccessDatabase(playerid);
        return 1;
    }
    return 1;
}
EDIT :-
OnPlayerDisconnect Callback -
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file,"Player's Data");
    INI_WriteInt(file,"Status",pInfo[playerid][pRStatus]);
    INI_WriteInt(file,"Donator",pInfo[playerid][pRDonator]);
    INI_WriteInt(file,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
    INI_WriteInt(file,"Kills",pInfo[playerid][pRKills]);
    INI_WriteInt(file,"Deaths",pInfo[playerid][pRDeaths]);
    INI_Close(file);

    SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
    return 1;
}
Reply
#7

Write your integer for the admin level in the register dialog.

Код:
INI_WriteInt(file, "Admin", 0);
Reply
#8

Quote:
Originally Posted by eXeDev
Посмотреть сообщение
Write your integer for the admin level in the register dialog.

Код:
INI_WriteInt(file, "Admin", 0);
I have that,
Код:
INI_WriteInt(file,"Status",0);
The problem is Other Player's Stats is the same as My Stats.

EDIT :-
Like this - (Other Player's Stats)
Код:
Status = 5
Donator = 1
Cash = 782713
Scores = 19273
Kills = 203
Deaths = 201
My Stats -
Код:
Status = 5
Donator = 1
Cash = 782713
Scores = 19273
Kills = 203
Deaths = 201
Reply
#9

That's not the problem.
The problem is you need to set each pInfo[playerid] to 0 except passwords when the player disconnects.
For example:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    pInfo[playerid][pRStatus] = 0;
    return 1;
}
Reply
#10

Quote:
Originally Posted by Stinged
Посмотреть сообщение
That's not the problem.
The problem is you need to set each pInfo[playerid] to 0 except passwords when the player disconnects.
For example:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    pInfo[playerid][pRStatus] = 0;
    return 1;
}
Lol, whenever i leave the server it'll set my Admin Level to 0

EDIT :-
Why do i set it back to
Код:
pInfo[playerid][pRStatus] = 0;
Can you please tell me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)