How To Load Enums
#1

Hello,
I am having trouble loading some of the information for my server. I can load the players health, armour, and money because they have a default code that sets the value [below]

Код:
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
I have 4 enum values that i would like to load aswell
Код:
PlayerInfo[playerid][pGroup]
PlayerInfo[playerid][pFaction]
PlayerInfo[playerid][pJob]
PlayerInfo[playerid][pAdminLevel]
The problem im having is loading the values that have been saved for each of these when the user logs in. Here is a section of my login script.

Код:
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                    SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
                    //I WOULD LIKE TO LOAD THE ENUM VALUES HERE
                    SpawnPlayer(playerid);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
If anybody knows how to do this i would really appreciate it.
Reply
#2

When they login, you have to set the enums value.
Ex:
pawn Код:
//Logged in
PlayerInfo[playerid][pCash] = dini_Int(File,"Money");
Of course you will have to edit that a bit to your own saving system.
Reply
#3

Provide the "LoadUser" callback.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)