[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
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;
}
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;
}
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");
}
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","");
}
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");
}
//this is the function
forward PerseMoney(playerid, name[], value[]);
public PerseMoney(playerid, name[], value[])
{
if(!strcmp(name, "Money"))SetPVarInt(playerid,"Money", strval(value));
//this just an exampe u can use what ever your one is like:
if(!strcmp(name, "Admin Level"))SetPVarInt(playerid,"Admin Level", strval(value));
}
INI_ParseFile(file, "PerseMoney", false, true, playerid, true, false );
when loading information you would need to perse that information first like this
Example pawn Code:
you use 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;
}
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
if(!strcmp(name, "Password"))SetPVarInt(playerid,"Password", strval(value));
if(!strcmp(name, "Level"))SetPVarInt(playerid,"LEVEL", strval(value));
if(!strcmp(name, "Admin "))SetPVarInt(playerid,"ADMINLEVEL", strval(value));
if(!strcmp(name, "Wired"))SetPVarInt(playerid,"WIRED", strval(value));
if(!strcmp(name, "Jailed"))SetPVarInt(playerid,"JAILED", strval(value));
if(!strcmp(name, "Job"))SetPVarInt(playerid,"JOB", strval(value));
if(!strcmp(name, "Faction"))SetPVarInt(playerid,"FACTION", strval(value));
if(!strcmp(name, "Car"))SetPVarInt(playerid,"CAR", strval(value));
if(!strcmp(name, "Phone"))SetPVarInt(playerid,"PHONE", strval(value));
if(!strcmp(name, "Phonebook"))SetPVarInt(playerid,"PHONEBOOK", strval(value));
if(!strcmp(name, "Mask"))SetPVarInt(playerid,"MASK", strval(value));
if(!strcmp(name, "Condom"))SetPVarInt(playerid,"CONDOM", strval(value));
if(!strcmp(name, "Gun Skill"))SetPVarInt(playerid,"GUNSKILL", strval(value));
if(!strcmp(name, "Job Skill"))SetPVarInt(playerid,"JOBSKILL", strval(value));
if(!strcmp(name, "CarLic"))SetPVarInt(playerid,"CARLIC", strval(value));
if(!strcmp(name, "FlyLic"))SetPVarInt(playerid,"FLYLIC", strval(value));
if(!strcmp(name, "GunLic"))SetPVarInt(playerid,"GUNLIC", strval(value));
if(!strcmp(name, "Money"))SetPVarInt(playerid,"MONEY", strval(value));
if(!strcmp(name, "FacRank"))SetPVarInt(playerid,"FACRANK", strval(value));
}
ok no need for me to contact you ,we try to solve it here
![]() you know you have this pawn Code:
EDIT forgot the callback's D pawn Code:
|
yep
but make sure that LoadUser_data is being persed !!! when the player loges in ![]() |
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
if(!strcmp(name, "Password"))SetPVarInt(playerid,"Password", strval(value));
if(!strcmp(name, "Level"))SetPVarInt(playerid,"LEVEL", strval(value));
if(!strcmp(name, "Admin "))SetPVarInt(playerid,"ADMINLEVEL", strval(value));
if(!strcmp(name, "Wired"))SetPVarInt(playerid,"WIRED", strval(value));
if(!strcmp(name, "Jailed"))SetPVarInt(playerid,"JAILED", strval(value));
if(!strcmp(name, "Job"))SetPVarInt(playerid,"JOB", strval(value));
if(!strcmp(name, "Faction"))SetPVarInt(playerid,"FACTION", strval(value));
if(!strcmp(name, "Car"))SetPVarInt(playerid,"CAR", strval(value));
if(!strcmp(name, "Phone"))SetPVarInt(playerid,"PHONE", strval(value));
if(!strcmp(name, "Phonebook"))SetPVarInt(playerid,"PHONEBOOK", strval(value));
if(!strcmp(name, "Mask"))SetPVarInt(playerid,"MASK", strval(value));
if(!strcmp(name, "Condom"))SetPVarInt(playerid,"CONDOM", strval(value));
if(!strcmp(name, "Gun Skill"))SetPVarInt(playerid,"GUNSKILL", strval(value));
if(!strcmp(name, "Job Skill"))SetPVarInt(playerid,"JOBSKILL", strval(value));
if(!strcmp(name, "CarLic"))SetPVarInt(playerid,"CARLIC", strval(value));
if(!strcmp(name, "FlyLic"))SetPVarInt(playerid,"FLYLIC", strval(value));
if(!strcmp(name, "GunLic"))SetPVarInt(playerid,"GUNLIC", strval(value));
if(!strcmp(name, "Money"))SetPVarInt(playerid,"MONEY", strval(value));
if(!strcmp(name, "FacRank"))SetPVarInt(playerid,"FACRANK", strval(value));
}
new name[MAX_PLAYER_NAME],file[80];GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/THE LOCATION OF THE SAVE FILE/%s.txt",name);//NOTE: make sure to change the location
INI_ParseFile(file, "LoadUser_data", false, true, playerid, true, false);//This will perse the files!
//Now to laod them do this
LoadPlayerData(playerid);//you put this after the date has been persed
//Now put this callback at teh botttom of your script!
forward LoadPlayerData(playerid);
public LoadPlayerData(playerid)
{
new name[MAX_PLAYER_NAME],file[80];GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/THE LOCATION OF THE SAVE FILE/%s.txt",name);//NOTE: make sure to change the location
if(fexist(file))
{
PlayerInfo[playerid][LEVEL] = GetPVarInt(playerid, "Level");
PlayerInfo[playerid][ADMINLEVEL] = GetPVarInt(playerid, "Admin Level");
PlayerInfo[playerid][WIRED] = GetPVarInt(playerid, "Wired");
PlayerInfo[playerid][JAILED] = GetPVarInt(playerid, "Jailed");
PlayerInfo[playerid][JOB] = GetPVarInt(playerid, "Job");
PlayerInfo[playerid][FACTION] = GetPVarInt(playerid, "Faction");
PlayerInfo[playerid][CAR] = GetPVarInt(playerid, "Car");
PlayerInfo[playerid][PHONE] = GetPVarInt(playerid, "Phone");
PlayerInfo[playerid][PHONEBOOK] = GetPVarInt(playerid, "Phonebook");
PlayerInfo[playerid][MASK] = GetPVarInt(playerid, "Mask");
PlayerInfo[playerid][CONDOM] = GetPVarInt(playerid, "Condom");
PlayerInfo[playerid][GUNSKILL] = GetPVarInt(playerid, "Gun Skill");
PlayerInfo[playerid][JOBSKILL] = GetPVarInt(playerid, "Job Skill");
PlayerInfo[playerid][CARLIC] = GetPVarInt(playerid, "CarLic");
PlayerInfo[playerid][FLYLIC] = GetPVarInt(playerid, "FlyLic");
PlayerInfo[playerid][GUNLIC] = GetPVarInt(playerid, "GunLic");
PlayerInfo[playerid][FACRANK] = GetPVarInt(playerid, "FacRank");
GivePlayerMoney(playerid,GetPVarInt(playerid, "Money"));
}
}
return 1;
}