How To Load Enums - 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: How To Load Enums (
/showthread.php?tid=390588)
How To Load Enums -
stuoyto - 06.11.2012
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.
Re: How To Load Enums -
willsuckformoney - 06.11.2012
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.
Re: How To Load Enums -
Steven82 - 07.11.2012
Provide the "LoadUser" callback.