enum pInfo
#1

How do you save enum pInfo to player file?

I need to save admin level to the player file, but i cant figure out how to.
The Admin is in "enum pInfo"

Everything is saved when disconnect, "Member" "Leader" "Status" "Request" "IsRequesting" Score" "Jail", and uses ""new "Member[MAX_PLAYERS];"" and not "enum pInfo" .

And i cant change admin the way "new "Member[MAX_PLAYERS];" etc is made, then i got errors, even if i put every part on right place.

Ill show you the code
pawn Code:
new Member[MAX_PLAYERS];
new Leader[MAX_PLAYERS];
new request[MAX_PLAYERS];
new IsRequesting[MAX_PLAYERS];
new Score[MAX_PLAYERS];
new Jail[MAX_PLAYERS];

enum pInfo
{
    Pass,
    Money,
    Admin,
    Level,
    Vip,
    Spawn,
};

public OnPlayerRegister(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
        new file[64];
        new playername3[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername3, sizeof(playername3));
        format(file, sizeof(file), "/Users/%s.ini", playername3);

        if(dini_Exists(file))
        {
            return SendClientMessage(playerid,COLOR_GREY,"This account is already registered.");
        }
        else
        {
            dini_Create(file);
            new password2 = num_hash(password);
            PlayerInfo[playerid][Pass] = password2;
            dini_IntSet(file, "Password",password2);
            dini_IntSet(file, "Member", Member[playerid]);
            dini_IntSet(file, "Leader", Leader[playerid]);
            dini_IntSet(file, "Status", IsInOrg[playerid]);
            dini_IntSet(file, "Request", request[playerid]);
            dini_IntSet(file, "IsRequesting", IsRequesting[playerid]);
            dini_IntSet(file, "Score", Score[playerid]);
            dini_IntSet(file, "Jail", Jail[playerid]);
            ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun Venit",""ALB"Account succesfully registred!\n"ALB"Type your password here to log-in","Log-in","Quit");
        }
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"/Users/%s.ini",name);
    if(dini_Exists(file))
    {
        dini_IntSet(file, "Member", Member[playerid]);
        dini_IntSet(file, "Leader", Leader[playerid]);
        dini_IntSet(file, "Status", IsInOrg[playerid]);
        dini_IntSet(file, "Request", request[playerid]);
        dini_IntSet(file, "IsRequesting", IsRequesting[playerid]);
        dini_IntSet(file, "Score", Score[playerid]);
        dini_IntSet(file, "Jail", Jail[playerid]);
    }
    gPlayerLogged[playerid] = 0;
    new playername3[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", playername3);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", playername3);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", playername3);
    }
    SendClientMessageToAll(0x33CCFFAA, string);

    return 1;
}

public OnPlayerLogin(playerid,password[])
{
    new file[64];
    new playername3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));

    format(file, sizeof(file), "/Users/%s.ini", playername3);

    if (dini_Exists(file))
    {
        new password2 = num_hash(password);
        if(dini_Int(file,"Password") == password2)
        {
            Member[playerid] = dini_Int(file, "Member");
            Leader[playerid] = dini_Int(file,"Leader");
            IsInOrg[playerid] = dini_Int(file,"Status");
            IsLaw[playerid] = dini_Int(file,"Law");
            request[playerid] = dini_Int(file,"Request");
            IsRequesting[playerid] = dini_Int(file,"Isrequesting");
            SetPlayerScore(playerid, dini_Int(file,"Score"));
            Jail[playerid] = dini_Int(file, "Jail");
        }
        else
        {
            gPlayerLogTries[playerid] += 1;
            ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Once againg!",""ALB"You have typed a wrong password\n"ALB"Type your password here to log-in!","Log-in","Quit");
            if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
            return 1;
        }
    }
    SpawnPlayer(playerid);
    return 1;
}
Reply


Messages In This Thread
enum pInfo - by cruising - 05.04.2011, 22:10
Re: enum pInfo - by [L3th4l] - 05.04.2011, 22:13
Re: enum pInfo - by cruising - 05.04.2011, 22:40
Re: enum pInfo - by [L3th4l] - 05.04.2011, 22:54
Re: enum pInfo - by cruising - 05.04.2011, 23:10

Forum Jump:


Users browsing this thread: 1 Guest(s)