27.10.2011, 20:27
I saw this tutorial on YINI, with Dialogs and crap... and I found otu something wierd
1. It doesnt save SOME information
2. If recreates some other stuff under the player config
My User INI File
When I log on my
Job is reset,
Admin Level is reset,
gun and job skill is reset,
Same with my money, hopefully you guys can help me
forwards for the loaduser
OnPlayerDisconnect
OnPlayerConnect
DIALOG_REGISTER
DIALOG_LOGIN
JUST BTW, I DO NOT HAVE COMPILING ERRORS! IT COMPILES FINE!
1. It doesnt save SOME information
2. If recreates some other stuff under the player config
My User INI File
pawn Code:
[data]
Password = **********
Level = 1
Admin Level = 1338
Wired = 0
Jailed = 0
Job = 0
Faction = 1
Car = 1
Phone = 1
Phonebook = 1
Mask = 1
Condom = 1
Gun Skill = 1
Job Skill = 1
CarLic = 1
FlyLic = 1
GunLic = 1
Money = 0
FacRank = 5
Admin Level = 0
Gun Skill = 0
Job Skill = 0
Admin Level = 0
Gun Skill = 0
Job Skill = 0
Admin Level = 0
Gun Skill = 0
Job Skill = 0
Admin Level = 0
Gun Skill = 0
Job Skill = 0
Job is reset,
Admin Level is reset,
gun and job skill is reset,
Same with my money, hopefully you guys can help me
forwards for the loaduser
pawn Code:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PInfo[playerid][PASS]);
INI_Int("Level",PInfo[playerid][LEVEL]);
INI_Int("Admin Level",PInfo[playerid][ADMINLEVEL]);
INI_Int("Wired",PInfo[playerid][WIRED]);
INI_Int("Jailed",PInfo[playerid][JAILED]);
INI_Int("Job",PInfo[playerid][JOB]);
INI_Int("Faction",PInfo[playerid][FACTION]);
INI_Int("Car",PInfo[playerid][CAR]);
INI_Int("Phone",PInfo[playerid][PHONE]);
INI_Int("Phonebook",PInfo[playerid][PHONEBOOK]);
INI_Int("Mask",PInfo[playerid][MASK]);
INI_Int("Condom",PInfo[playerid][CONDOM]);
INI_Int("Gun Skill",PInfo[playerid][GUNSKILL]);
INI_Int("Job Skill",PInfo[playerid][JOBSKILL]);
INI_Int("CarLic",PInfo[playerid][CARLIC]);
INI_Int("FlyLic",PInfo[playerid][FLYLIC]);
INI_Int("GunLic",PInfo[playerid][GUNLIC]);
INI_Int("Money",PInfo[playerid][MONEY]);
INI_Int("FacRank",Cop[playerid][FACRANK]);
return 1;
}
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
SetPVarInt(playerid,"LastID",-1);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Level",PInfo[playerid][LEVEL]);
INI_WriteInt(File,"Admin Level",PInfo[playerid][ADMINLEVEL]);
INI_WriteInt(File,"Wired",PInfo[playerid][WIRED]);
INI_WriteInt(File,"Jailed",PInfo[playerid][JAILED]);
INI_WriteInt(File,"Job",PInfo[playerid][JOB]);
INI_WriteInt(File,"Faction",PInfo[playerid][FACTION]);
INI_WriteInt(File,"Car",PInfo[playerid][CAR]);
INI_WriteInt(File,"Phone",PInfo[playerid][PHONE]);
INI_WriteInt(File,"Phonebook",PInfo[playerid][PHONEBOOK]);
INI_WriteInt(File,"Mask",PInfo[playerid][MASK]);
INI_WriteInt(File,"Condom",PInfo[playerid][CONDOM]);
INI_WriteInt(File,"Gun Skill",PInfo[playerid][GUNSKILL]);
INI_WriteInt(File,"Job Skill",PInfo[playerid][JOBSKILL]);
INI_WriteInt(File,"CarLic",PInfo[playerid][CARLIC]);
INI_WriteInt(File,"FlyLic",PInfo[playerid][FLYLIC]);
INI_WriteInt(File,"GunLic",PInfo[playerid][GUNLIC]);
INI_WriteInt(File,"Money",PInfo[playerid][MONEY]);
INI_WriteInt(File,"FacRank",Cop[playerid][FACRANK]);
INI_Close(File);
return 1;
}
pawn Code:
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
pawn Code:
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));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Level",0);
INI_WriteInt(File,"Admin Level",0);
INI_WriteInt(File,"Wired",0);
INI_WriteInt(File,"Jailed",0);
INI_WriteInt(File,"Job",0);
INI_WriteInt(File,"Faction",0);
INI_WriteInt(File,"Car",0);
INI_WriteInt(File,"Phone",0);
INI_WriteInt(File,"Phonebook",0);
INI_WriteInt(File,"Mask",0);
INI_WriteInt(File,"Condom",0);
INI_WriteInt(File,"Gun Skill",0);
INI_WriteInt(File,"Job Skill",0);
INI_WriteInt(File,"CarLic",0);
INI_WriteInt(File,"FlyLic",0);
INI_WriteInt(File,"GunLic",0);
INI_WriteInt(File,"Money",0);
INI_WriteInt(File,"FacRank",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Have fun playing ReailityC Roleplay!","Ok","");
}
pawn Code:
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PInfo[playerid][PASS])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PInfo[playerid][MONEY]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
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");
}