28.05.2015, 14:16
Hi I have used Y_INI before, but now its just confusing me so much, when I set my faction rank to 10, or 9 etc. The stat saves it as 0, I have no clue at whats going and its also now saving the password at the bottom of the file instead of the top, heres the codes for the login and the ini file:
OnPlayerDisconnect:
Can someone please tell me if there is something I should be looking for, or even a common mistake that happens when making y_ini systems?
pawn Код:
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pAge,
pSkin,
Float: PosX,
Float: PosY,
Float: PosZ,
Float: Angle,
pGender,
pFaction,
pRank,
fLeader,
fDivision,
fDivLeader,
fBadgeNum,
pGang,
gRank,
pCrack,
pWeed,
pMeth,
pVIP,
pMaterials,
HouseOwner,
BizID,
pVehicle1,
pVehicle1Model,
Float:pVehicle1X,
Float:pVehicle1Y,
Float:pVehicle1Z,
Float:pVehicle1C,
pVehicle1Color1,
pVehicle1Color2,
pVehicle1Value,
pVehicle1Plate,
pVehicle1Lock,
pVehicle2,
pVehicle2Model,
Float:pVehicle2X,
Float:pVehicle2Y,
Float:pVehicle2Z,
Float:pVehicle2C,
pVehicle2Color1,
pVehicle2Color2,
pVehicle2Value,
pVehicle2Plate,
pVehicle2Lock,
pVehicle3,
pVehicle3Model,
Float:pVehicle3X,
Float:pVehicle3Y,
Float:pVehicle3Z,
Float:pVehicle3C,
pVehicle3Color1,
pVehicle3Color2,
pVehicle3Value,
pVehicle3Plate,
pVehicle3Lock,
pJob,
Weapon1,
Weapon1a,
Weapon2,
Weapon2a,
Weapon3,
Weapon3a,
Weapon4,
Weapon4a,
Weapon5,
Weapon5a,
Weapon6,
Weapon6a,
Weapon7,
Weapon7a,
Weapon8,
Weapon8a,
Weapon9,
Weapon9a,
Weapon10,
Weapon10a,
Weapon11,
Weapon11a,
Weapon12,
Weapon12a,
pWepLic,
pAccent,
pNumber,
pCell
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
GetPlayerPos( playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
GetPlayerFacingAngle( playerid, PlayerInfo[playerid][Angle] );
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteFloat(File,"PosX",PlayerInfo[playerid][PosX]);
INI_WriteFloat(File,"PosY",PlayerInfo[playerid][PosY]);
INI_WriteFloat(File,"PosZ",PlayerInfo[playerid][PosZ]);
INI_WriteFloat(File,"Angle",PlayerInfo[playerid][Angle]);
INI_WriteInt(File,"Gender",PlayerInfo[playerid][pGender]);
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Leader",PlayerInfo[playerid][fLeader]);
INI_WriteInt(File,"Division",PlayerInfo[playerid][fDivision]);
INI_WriteInt(File,"DivLeader",PlayerInfo[playerid][fDivLeader]);
INI_WriteInt(File,"BadgeNum",PlayerInfo[playerid][fBadgeNum]);
INI_WriteInt(File,"Gang",PlayerInfo[playerid][pGang]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][gRank]);
INI_WriteInt(File,"Crack",PlayerInfo[playerid][pCrack]);
INI_WriteInt(File,"Weed",PlayerInfo[playerid][pWeed]);
INI_WriteInt(File,"Meth",PlayerInfo[playerid][pMeth]);
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"Materials",PlayerInfo[playerid][pMaterials]);
INI_WriteInt(File,"HouseOwner",PlayerInfo[playerid][HouseOwner]);
INI_WriteInt(File,"BizID",PlayerInfo[playerid][BizID]);
INI_WriteInt(File,"Vehicle1",PlayerInfo[playerid][pVehicle1]);
INI_WriteInt(File,"Vehicle1Model",PlayerInfo[playerid][pVehicle1Model]);
INI_WriteFloat(File,"Vehicle1X",PlayerInfo[playerid][pVehicle1X]);
INI_WriteFloat(File,"Vehicle1Y",PlayerInfo[playerid][pVehicle1Y]);
INI_WriteFloat(File,"Vehicle1Z",PlayerInfo[playerid][pVehicle1Z]);
INI_WriteFloat(File,"Vehicle1C",PlayerInfo[playerid][pVehicle1C]);
INI_WriteInt(File,"Vehicle1Color1",PlayerInfo[playerid][pVehicle1Color1]);
INI_WriteInt(File,"Vehicle1Color2",PlayerInfo[playerid][pVehicle1Color2]);
INI_WriteInt(File,"Vehicle1Value",PlayerInfo[playerid][pVehicle1Value]);
INI_WriteString(File,"Vehicle1Plate",PlayerInfo[playerid][pVehicle1Plate]);
INI_WriteInt(File,"Vehicle1Lock",PlayerInfo[playerid][pVehicle1Lock]);
INI_WriteInt(File,"Vehicle2",PlayerInfo[playerid][pVehicle2]);
INI_WriteInt(File,"Vehicle2Model",PlayerInfo[playerid][pVehicle2Model]);
INI_WriteFloat(File,"Vehicle2X",PlayerInfo[playerid][pVehicle2X]);
INI_WriteFloat(File,"Vehicle2Y",PlayerInfo[playerid][pVehicle2Y]);
INI_WriteFloat(File,"Vehicle2Z",PlayerInfo[playerid][pVehicle2Z]);
INI_WriteFloat(File,"Vehicle2C",PlayerInfo[playerid][pVehicle2C]);
INI_WriteInt(File,"Vehicle2Color1",PlayerInfo[playerid][pVehicle2Color1]);
INI_WriteInt(File,"Vehicle2Color2",PlayerInfo[playerid][pVehicle2Color2]);
INI_WriteInt(File,"Vehicle2Value",PlayerInfo[playerid][pVehicle2Value]);
INI_WriteString(File,"Vehicle2Plate",PlayerInfo[playerid][pVehicle2Plate]);
INI_WriteInt(File,"Vehicle2Lock",PlayerInfo[playerid][pVehicle2Lock]);
INI_WriteInt(File,"Vehicle3",PlayerInfo[playerid][pVehicle3]);
INI_WriteInt(File,"Vehicle3Model",PlayerInfo[playerid][pVehicle3Model]);
INI_WriteFloat(File,"Vehicle3X",PlayerInfo[playerid][pVehicle3X]);
INI_WriteFloat(File,"Vehicle3Y",PlayerInfo[playerid][pVehicle3Y]);
INI_WriteFloat(File,"Vehicle3Z",PlayerInfo[playerid][pVehicle3Z]);
INI_WriteFloat(File,"Vehicle3C",PlayerInfo[playerid][pVehicle3C]);
INI_WriteInt(File,"Vehicle3Color1",PlayerInfo[playerid][pVehicle3Color1]);
INI_WriteInt(File,"Vehicle3Color2",PlayerInfo[playerid][pVehicle3Color2]);
INI_WriteInt(File,"Vehicle3Value",PlayerInfo[playerid][pVehicle3Value]);
INI_WriteString(File,"Vehicle3Plate",PlayerInfo[playerid][pVehicle3Plate]);
INI_WriteInt(File,"Vehicle3Lock",PlayerInfo[playerid][pVehicle3Lock]);
INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob]);
INI_WriteInt(File,"Weapon1", PlayerInfo[playerid][Weapon1]);
INI_WriteInt(File,"Weapon1a", PlayerInfo[playerid][Weapon1a]);
INI_WriteInt(File,"Weapon2", PlayerInfo[playerid][Weapon2]);
INI_WriteInt(File,"Weapon2a", PlayerInfo[playerid][Weapon2a]);
INI_WriteInt(File,"Weapon3", PlayerInfo[playerid][Weapon3]);
INI_WriteInt(File,"Weapon3a", PlayerInfo[playerid][Weapon3a]);
INI_WriteInt(File,"Weapon4", PlayerInfo[playerid][Weapon4]);
INI_WriteInt(File,"Weapon4a", PlayerInfo[playerid][Weapon4a]);
INI_WriteInt(File,"Weapon5", PlayerInfo[playerid][Weapon5]);
INI_WriteInt(File,"Weapon5a", PlayerInfo[playerid][Weapon5a]);
INI_WriteInt(File,"Weapon6", PlayerInfo[playerid][Weapon6]);
INI_WriteInt(File,"Weapon6a", PlayerInfo[playerid][Weapon6a]);
INI_WriteInt(File,"Weapon7", PlayerInfo[playerid][Weapon7]);
INI_WriteInt(File,"Weapon7a", PlayerInfo[playerid][Weapon7a]);
INI_WriteInt(File,"Weapon8", PlayerInfo[playerid][Weapon8]);
INI_WriteInt(File,"Weapon8a", PlayerInfo[playerid][Weapon8a]);
INI_WriteInt(File,"Weapon9", PlayerInfo[playerid][Weapon9]);
INI_WriteInt(File,"Weapon9a", PlayerInfo[playerid][Weapon9a]);
INI_WriteInt(File,"Weapon10", PlayerInfo[playerid][Weapon10]);
INI_WriteInt(File,"Weapon10a", PlayerInfo[playerid][Weapon10a]);
INI_WriteInt(File,"Weapon11", PlayerInfo[playerid][Weapon11]);
INI_WriteInt(File,"Weapon11a", PlayerInfo[playerid][Weapon11a]);
INI_WriteInt(File,"Weapon12", PlayerInfo[playerid][Weapon12]);
INI_WriteInt(File,"Weapon12a", PlayerInfo[playerid][Weapon12a]);
INI_WriteInt(File,"WepLic", PlayerInfo[playerid][pWepLic]);
INI_WriteInt(File,"Accent", PlayerInfo[playerid][pAccent]);
INI_WriteInt(File,"Number",PlayerInfo[playerid][pNumber]);
INI_WriteInt(File,"Cell",PlayerInfo[playerid][pCell]);
INI_Close(File);
pawn Код:
switch( dialogid )
{
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,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Age",0);
INI_WriteInt(File,"Skin",0);
INI_WriteFloat(File,"PosX",0.0);
INI_WriteFloat(File,"PosY",0.0);
INI_WriteFloat(File,"PosZ",0.0);
INI_WriteFloat(File,"Angle",0.0);
INI_WriteInt(File,"Gender",0);
INI_WriteInt(File,"Faction",0);
INI_WriteInt(File,"Rank",0);
INI_WriteInt(File,"Leader",0);
INI_WriteInt(File,"Division",0);
INI_WriteInt(File,"DivLeader",0);
INI_WriteInt(File,"BadgeNum",0);
INI_WriteInt(File,"Gang",0);
INI_WriteInt(File,"Rank",0);
INI_WriteInt(File,"Crack",0);
INI_WriteInt(File,"Weed",0);
INI_WriteInt(File,"Meth",0);
INI_WriteInt(File,"VIP",0);
INI_WriteInt(File,"Materials",0);
INI_WriteInt(File,"HouseOwner",0);
INI_WriteInt(File,"BizID",0);
INI_WriteInt(File,"Vehicle1",PlayerInfo[playerid][pVehicle1]);
INI_WriteInt(File,"Vehicle1Model",PlayerInfo[playerid][pVehicle1Model]);
INI_WriteFloat(File,"Vehicle1X",PlayerInfo[playerid][pVehicle1X]);
INI_WriteFloat(File,"Vehicle1Y",PlayerInfo[playerid][pVehicle1Y]);
INI_WriteFloat(File,"Vehicle1Z",PlayerInfo[playerid][pVehicle1Z]);
INI_WriteFloat(File,"Vehicle1C",PlayerInfo[playerid][pVehicle1C]);
INI_WriteInt(File,"Vehicle1Color1",PlayerInfo[playerid][pVehicle1Color1]);
INI_WriteInt(File,"Vehicle1Color2",PlayerInfo[playerid][pVehicle1Color2]);
INI_WriteInt(File,"Vehicle1Value",PlayerInfo[playerid][pVehicle1Value]);
INI_WriteString(File,"Vehicle1Plate",PlayerInfo[playerid][pVehicle1Plate]);
INI_WriteInt(File,"Vehicle1Lock",PlayerInfo[playerid][pVehicle1Lock]);
INI_WriteInt(File,"Vehicle2",PlayerInfo[playerid][pVehicle2]);
INI_WriteInt(File,"Vehicle2Model",PlayerInfo[playerid][pVehicle2Model]);
INI_WriteFloat(File,"Vehicle2X",PlayerInfo[playerid][pVehicle2X]);
INI_WriteFloat(File,"Vehicle2Y",PlayerInfo[playerid][pVehicle2Y]);
INI_WriteFloat(File,"Vehicle2Z",PlayerInfo[playerid][pVehicle2Z]);
INI_WriteFloat(File,"Vehicle2C",PlayerInfo[playerid][pVehicle2C]);
INI_WriteInt(File,"Vehicle2Color1",PlayerInfo[playerid][pVehicle2Color1]);
INI_WriteInt(File,"Vehicle2Color2",PlayerInfo[playerid][pVehicle2Color2]);
INI_WriteInt(File,"Vehicle2Value",PlayerInfo[playerid][pVehicle2Value]);
INI_WriteString(File,"Vehicle2Plate",PlayerInfo[playerid][pVehicle2Plate]);
INI_WriteInt(File,"Vehicle2Lock",PlayerInfo[playerid][pVehicle2Lock]);
INI_WriteInt(File,"Vehicle3",PlayerInfo[playerid][pVehicle3]);
INI_WriteInt(File,"Vehicle3Model",PlayerInfo[playerid][pVehicle3Model]);
INI_WriteFloat(File,"Vehicle3X",PlayerInfo[playerid][pVehicle3X]);
INI_WriteFloat(File,"Vehicle3Y",PlayerInfo[playerid][pVehicle3Y]);
INI_WriteFloat(File,"Vehicle3Z",PlayerInfo[playerid][pVehicle3Z]);
INI_WriteFloat(File,"Vehicle3C",PlayerInfo[playerid][pVehicle3C]);
INI_WriteInt(File,"Vehicle3Color1",PlayerInfo[playerid][pVehicle3Color1]);
INI_WriteInt(File,"Vehicle3Color2",PlayerInfo[playerid][pVehicle3Color2]);
INI_WriteInt(File,"Vehicle3Value",PlayerInfo[playerid][pVehicle3Value]);
INI_WriteString(File,"Vehicle3Plate",PlayerInfo[playerid][pVehicle3Plate]);
INI_WriteInt(File,"Vehicle3Lock",PlayerInfo[playerid][pVehicle3Lock]);
INI_WriteInt(File,"Job",0);
INI_WriteInt(File,"Weapon1", 0);
INI_WriteInt(File,"Weapon1a", 0);
INI_WriteInt(File,"Weapon2", 0);
INI_WriteInt(File,"Weapon2a", 0);
INI_WriteInt(File,"Weapon3", 0);
INI_WriteInt(File,"Weapon3a", 0);
INI_WriteInt(File,"Weapon4", 0);
INI_WriteInt(File,"Weapon4a", 0);
INI_WriteInt(File,"Weapon5", 0);
INI_WriteInt(File,"Weapon5a", 0);
INI_WriteInt(File,"Weapon6", 0);
INI_WriteInt(File,"Weapon6a", 0);
INI_WriteInt(File,"Weapon7", 0);
INI_WriteInt(File,"Weapon7a", 0);
INI_WriteInt(File,"Weapon8", 0);
INI_WriteInt(File,"Weapon8a", 0);
INI_WriteInt(File,"Weapon9", 0);
INI_WriteInt(File,"Weapon9a", 0);
INI_WriteInt(File,"Weapon10", 0);
INI_WriteInt(File,"Weapon10a", 0);
INI_WriteInt(File,"Weapon11", 0);
INI_WriteInt(File,"Weapon11a", 0);
INI_WriteInt(File,"Weapon12", 0);
INI_WriteInt(File,"Weapon12a", 0);
INI_WriteInt(File,"WepLic", 0);
INI_WriteInt(File,"Accent", 0);
INI_WriteInt(File,"Number",0);
INI_WriteInt(File,"Cell",0);
INI_Close(File);
TogglePlayerControllable(playerid, 0);
TogglePlayerSpectating(playerid, 1);
ShowPlayerDialog(playerid, DIALOG_CC_AGE, DIALOG_STYLE_INPUT, "Character Creation - Age", "Please enter your characters age below:", "Conintue", "");
}
}
case DIALOG_LOGIN:
{
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]);
TogglePlayerSpectating(playerid, false);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ], PlayerInfo[playerid][Angle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon1], PlayerInfo[playerid][Weapon1a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon2], PlayerInfo[playerid][Weapon2a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon3], PlayerInfo[playerid][Weapon3a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon4], PlayerInfo[playerid][Weapon4a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon5], PlayerInfo[playerid][Weapon5a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon6], PlayerInfo[playerid][Weapon6a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon7], PlayerInfo[playerid][Weapon7a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon8], PlayerInfo[playerid][Weapon8a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon9], PlayerInfo[playerid][Weapon9a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon10], PlayerInfo[playerid][Weapon10a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon11], PlayerInfo[playerid][Weapon11a]);
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][Weapon12], PlayerInfo[playerid][Weapon12a]);
LoadPlayerVehicles(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;
}
}
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Float("PosX",PlayerInfo[playerid][PosX]);
INI_Float("PosY",PlayerInfo[playerid][PosY]);
INI_Float("PosZ",PlayerInfo[playerid][PosZ]);
INI_Float("Angle",PlayerInfo[playerid][Angle]);
INI_Int("Gender",PlayerInfo[playerid][pGender]);
INI_Int("Faction",PlayerInfo[playerid][pFaction]);
INI_Int("Rank",PlayerInfo[playerid][pRank]);
INI_Int("Leader",PlayerInfo[playerid][fLeader]);
INI_Int("Division",PlayerInfo[playerid][fDivision]);
INI_Int("DivLeader",PlayerInfo[playerid][fDivLeader]);
INI_Int("BadgeNum",PlayerInfo[playerid][fBadgeNum]);
INI_Int("Gang",PlayerInfo[playerid][pGang]);
INI_Int("Rank",PlayerInfo[playerid][gRank]);
INI_Int("Crack",PlayerInfo[playerid][pCrack]);
INI_Int("Weed",PlayerInfo[playerid][pWeed]);
INI_Int("Meth",PlayerInfo[playerid][pMeth]);
INI_Int("VIP",PlayerInfo[playerid][pVIP]);
INI_Int("Materials",PlayerInfo[playerid][pMaterials]);
INI_Int("HouseOwner",PlayerInfo[playerid][HouseOwner]);
INI_Int("BizID",PlayerInfo[playerid][BizID]);
INI_Int("Vehicle1",PlayerInfo[playerid][pVehicle1]);
INI_Int("Vehicle1Model",PlayerInfo[playerid][pVehicle1Model]);
INI_Float("Vehicle1X",PlayerInfo[playerid][pVehicle1X]);
INI_Float("Vehicle1Y",PlayerInfo[playerid][pVehicle1Y]);
INI_Float("Vehicle1Z",PlayerInfo[playerid][pVehicle1Z]);
INI_Float("Vehicle1C",PlayerInfo[playerid][pVehicle1C]);
INI_Int("Vehicle1Color1",PlayerInfo[playerid][pVehicle1Color1]);
INI_Int("Vehicle1Color2",PlayerInfo[playerid][pVehicle1Color2]);
INI_Int("Vehicle1Value",PlayerInfo[playerid][pVehicle1Value]);
INI_Int("Vehicle1Plate",PlayerInfo[playerid][pVehicle1Plate]);
INI_Int("Vehicle1Lock",PlayerInfo[playerid][pVehicle1Lock]);
INI_Int("Vehicle2",PlayerInfo[playerid][pVehicle2]);
INI_Int("Vehicle2Model",PlayerInfo[playerid][pVehicle2Model]);
INI_Float("Vehicle2X",PlayerInfo[playerid][pVehicle2X]);
INI_Float("Vehicle2Y",PlayerInfo[playerid][pVehicle2Y]);
INI_Float("Vehicle2Z",PlayerInfo[playerid][pVehicle2Z]);
INI_Float("Vehicle2C",PlayerInfo[playerid][pVehicle2C]);
INI_Int("Vehicle2Color1",PlayerInfo[playerid][pVehicle2Color1]);
INI_Int("Vehicle2Color2",PlayerInfo[playerid][pVehicle2Color2]);
INI_Int("Vehicle2Value",PlayerInfo[playerid][pVehicle2Value]);
INI_Int("Vehicle2Plate",PlayerInfo[playerid][pVehicle2Plate]);
INI_Int("Vehicle2Lock",PlayerInfo[playerid][pVehicle2Lock]);
INI_Int("Vehicle3",PlayerInfo[playerid][pVehicle3]);
INI_Int("Vehicle3Model",PlayerInfo[playerid][pVehicle3Model]);
INI_Float("Vehicle3X",PlayerInfo[playerid][pVehicle3X]);
INI_Float("Vehicle3Y",PlayerInfo[playerid][pVehicle3Y]);
INI_Float("Vehicle3Z",PlayerInfo[playerid][pVehicle3Z]);
INI_Float("Vehicle3C",PlayerInfo[playerid][pVehicle3C]);
INI_Int("Vehicle3Color1",PlayerInfo[playerid][pVehicle3Color1]);
INI_Int("Vehicle3Color2",PlayerInfo[playerid][pVehicle3Color2]);
INI_Int("Vehicle3Value",PlayerInfo[playerid][pVehicle3Value]);
INI_Int("Vehicle3Plate",PlayerInfo[playerid][pVehicle3Plate]);
INI_Int("Vehicle3Lock",PlayerInfo[playerid][pVehicle3Lock]);
INI_Int("Job",PlayerInfo[playerid][pJob]);
INI_Int("Weapon1", PlayerInfo[playerid][Weapon1]);
INI_Int("Weapon1a", PlayerInfo[playerid][Weapon1a]);
INI_Int("Weapon2", PlayerInfo[playerid][Weapon2]);
INI_Int("Weapon2a", PlayerInfo[playerid][Weapon2a]);
INI_Int("Weapon3", PlayerInfo[playerid][Weapon3]);
INI_Int("Weapon3a", PlayerInfo[playerid][Weapon3a]);
INI_Int("Weapon4", PlayerInfo[playerid][Weapon4]);
INI_Int("Weapon4a", PlayerInfo[playerid][Weapon4a]);
INI_Int("Weapon5", PlayerInfo[playerid][Weapon5]);
INI_Int("Weapon5a", PlayerInfo[playerid][Weapon5a]);
INI_Int("Weapon6", PlayerInfo[playerid][Weapon6]);
INI_Int("Weapon6a", PlayerInfo[playerid][Weapon6a]);
INI_Int("Weapon7", PlayerInfo[playerid][Weapon7]);
INI_Int("Weapon7a", PlayerInfo[playerid][Weapon7a]);
INI_Int("Weapon8", PlayerInfo[playerid][Weapon8]);
INI_Int("Weapon8a", PlayerInfo[playerid][Weapon8a]);
INI_Int("Weapon9", PlayerInfo[playerid][Weapon9]);
INI_Int("Weapon9a", PlayerInfo[playerid][Weapon9a]);
INI_Int("Weapon10", PlayerInfo[playerid][Weapon10]);
INI_Int("Weapon10a", PlayerInfo[playerid][Weapon10a]);
INI_Int("Weapon11", PlayerInfo[playerid][Weapon11]);
INI_Int("Weapon11a", PlayerInfo[playerid][Weapon11a]);
INI_Int("Weapon12", PlayerInfo[playerid][Weapon12]);
INI_Int("Weapon12a", PlayerInfo[playerid][Weapon12a]);
INI_Int("WepLic", PlayerInfo[playerid][pWepLic]);
INI_Int("Accent", PlayerInfo[playerid][pAccent]);
INI_Int("Number",PlayerInfo[playerid][pNumber]);
INI_Int("Cell",PlayerInfo[playerid][pCell]);
return 1;
}
stock LoadPlayerVehicles(playerid)
{
if(PlayerInfo[playerid][pVehicle1] != 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new model1 = PlayerInfo[playerid][pVehicle1Model];
new Float:car1x = PlayerInfo[playerid][pVehicle1X];
new Float:car1y = PlayerInfo[playerid][pVehicle1Y];
new Float:car1z = PlayerInfo[playerid][pVehicle1Z];
new Float:car1c = PlayerInfo[playerid][pVehicle1C];
new car1color1 = PlayerInfo[playerid][pVehicle1Color1];
new car1color2 = PlayerInfo[playerid][pVehicle1Color2];
new car1lock = PlayerInfo[playerid][pVehicle1Lock];
personalcar1[playerid] = CreateVehicle(model1, car1x, car1y, car1z, car1c, car1color1, car1color2, 999999);
SetVehicleNumberPlate(personalcar1[playerid], PlayerInfo[playerid][pVehicle1Plate]);
if(car1lock != 0)
{
GetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
}
}
if(PlayerInfo[playerid][pVehicle2] != 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new model2 = PlayerInfo[playerid][pVehicle2Model];
new Float:car2x = PlayerInfo[playerid][pVehicle2X];
new Float:car2y = PlayerInfo[playerid][pVehicle2Y];
new Float:car2z = PlayerInfo[playerid][pVehicle2Z];
new Float:car2c = PlayerInfo[playerid][pVehicle2C];
new car2color1 = PlayerInfo[playerid][pVehicle2Color1];
new car2color2 = PlayerInfo[playerid][pVehicle2Color2];
new car2lock = PlayerInfo[playerid][pVehicle2Lock];
personalcar2[playerid] = CreateVehicle(model2, car2x, car2y, car2z, car2c, car2color1, car2color2, 999999);
SetVehicleNumberPlate(personalcar2[playerid], PlayerInfo[playerid][pVehicle2Plate]);
if(car2lock != 0)
{
GetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
}
}
if(PlayerInfo[playerid][pVehicle3] != 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new model3 = PlayerInfo[playerid][pVehicle3Model];
new Float:car3x = PlayerInfo[playerid][pVehicle3X];
new Float:car3y = PlayerInfo[playerid][pVehicle3Y];
new Float:car3z = PlayerInfo[playerid][pVehicle3Z];
new Float:car3c = PlayerInfo[playerid][pVehicle3C];
new car3color1 = PlayerInfo[playerid][pVehicle3Color1];
new car3color2 = PlayerInfo[playerid][pVehicle3Color2];
new car3lock = PlayerInfo[playerid][pVehicle3Lock];
personalcar3[playerid] = CreateVehicle(model3, car3x, car3y, car3z, car3c, car3color1, car3color2, 999999);
SetVehicleNumberPlate(personalcar3[playerid], PlayerInfo[playerid][pVehicle3Plate]);
if(car3lock != 0)
{
GetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
}
}
return 1;
}
forward SafeLogin(playerid);
public SafeLogin(playerid)
{
new string[500];
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
format(string, sizeof(string), "Welcome back %s!\n\nPlease type in your password below to log back into the server!", GetNameEx(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "ERP - Login", string, "Login", "Quit");
}
else
{
format(string, sizeof(string), "Welcome %s!\n\nWe have noticed you do not have an account registered with us!\nPlease type your password below to register a new account:", GetNameEx(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "ERP - Register", string, "Register", "Quit");
}
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}