13.08.2013, 18:20
Title pretty much explains it all. Y_INI isn't writing anything to the user files.
(Ignore any bad indention as it was caused when copying the code here)
(Ignore any bad indention as it was caused when copying the code here)
pawn Код:
public SaveAccountInfo(playerid)
{
new szField[128];
if(DebugEnabled == 1) { printf("DEBUG: SaveAccountInfo(%d)", playerid); }
new cash = GetMoney(playerid);
new skin = GetPlayerSkin(playerid);
new level = GetPlayerScore(playerid);
new int = GetPlayerInterior(playerid);
new vw = GetPlayerVirtualWorld(playerid);
new Float:X, Float:Y, Float:Z;
new Float:facingangle;
new Float:health, Float:armour;
printf("DEBUG: GetPlayer....()");
GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armour);
GetPlayerFacingAngle(playerid, facingangle);
GetPlayerPos(playerid, X, Y, Z);
printf("DEBUG: INI_Open()");
new INI:File = INI_Open(UserPath(playerid));
printf("DEBUG: INI_SetTag()");
INI_SetTag(File,"data");
printf("DEBUG: INI_WriteInt()");
INI_WriteInt(File,"Cash",cash);
INI_WriteInt(File,"Skin",skin);
INI_WriteInt(File,"Level",level);
INI_WriteInt(File,"Int",int);
INI_WriteInt(File,"VW",vw);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"AdminDivision",PlayerInfo[playerid][pAdminDivision]);
INI_WriteInt(File,"SecKey",PlayerInfo[playerid][pSecKey]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
printf("DEBUG: INI_WriteFloat()");
INI_WriteFloat(File, "FacingAngle", facingangle);
INI_WriteFloat(File, "Health", health);
INI_WriteFloat(File, "Armour", armour);
INI_WriteFloat(File, "LastX", X);
INI_WriteFloat(File, "LastY", Y);
INI_WriteFloat(File, "LastZ", Z);
printf("DEBUG: INI_WriteInt()");
INI_WriteInt(File,"Jailed",PlayerInfo[playerid][pJailed]);
INI_WriteInt(File,"JailTime",PlayerInfo[playerid][pJailTime]);
printf("DEBUG: INI_WriteString()");
INI_WriteString(File,"JailReason",PlayerInfo[playerid][pJailReason]);
INI_WriteString(File,"JailedBy",PlayerInfo[playerid][pJailedBy]);
printf("DEBUG: INI_WriteInt()");
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
printf("DEBUG: INI_WriteString()");
INI_WriteString(File,"BanReason",PlayerInfo[playerid][pBanReason]);
INI_WriteString(File,"IP",PlayerInfo[playerid][pIP]);
printf("DEBUG: INI_WriteInt()");
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);
INI_WriteInt(File,"FactionRank",PlayerInfo[playerid][pFactionRank]);
INI_WriteInt(File,"FactionDivision",PlayerInfo[playerid][pFactionDivision]);
INI_WriteInt(File,"Registered",PlayerInfo[playerid][pRegistered]);
INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank]);
printf("DEBUG: INI_WriteString()");
INI_WriteString(File,"Warrant",PlayerInfo[playerid][pWarrant]);
printf("DEBUG: INI_WriteInt()");
INI_WriteInt(File,"Wanted",PlayerInfo[playerid][pWanted]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
printf("DEBUG: INI_WriteString()");
INI_WriteString(File,"pOrigin",PlayerInfo[playerid][pOrigin]);
printf("DEBUG: INI_WriteInt()");
INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob]);
INI_WriteInt(File,"HouseKey",PlayerInfo[playerid][pHouseKey]);
INI_WriteInt(File,"Renting",PlayerInfo[playerid][pRenting]);//
INI_WriteInt(File,"ReportMuted",PlayerInfo[playerid][pReportMuted]);
INI_WriteInt(File,"PhoneNumber",PlayerInfo[playerid][pPhoneNumber]);
INI_WriteInt(File,"Cheque",PlayerInfo[playerid][pCheque]);
INI_WriteInt(File,"DrivingLicense",PlayerInfo[playerid][pDrivingLicense]);
INI_WriteInt(File,"Arrested",PlayerInfo[playerid][pArrested]);
INI_WriteInt(File,"Crimes",PlayerInfo[playerid][pCrimes]);
INI_WriteInt(File,"Hospital",PlayerInfo[playerid][pHospital]);
INI_WriteInt(File,"PayDay",PlayerInfo[playerid][pPayDay]);
INI_WriteInt(File,"BusinessKey",PlayerInfo[playerid][pBusinessKey]);
INI_WriteInt(File,"Cigar",PlayerInfo[playerid][pCigar]);
for(new i = 0; i < 12; i++)
{
format(szField, sizeof(szField), "Weapon%d", i);
INI_WriteInt(File,szField,PlayerInfo[playerid][pWeapon][i]);
}
for(new i = 0; i < 12; i++)
{
format(szField, sizeof(szField), "Weaponammo%d", i);
INI_WriteInt(File,szField,PlayerInfo[playerid][pWeapona][i]);
}
INI_WriteInt(File,"Radio",PlayerInfo[playerid][pRadio]);
INI_WriteInt(File,"RadioFreq",PlayerInfo[playerid][pRadioFreq]);
INI_WriteInt(File,"Donator",PlayerInfo[playerid][pDonator]);
INI_WriteInt(File,"DonatorTime",PlayerInfo[playerid][pDonatorTime]);
INI_WriteInt(File,"Sprunk",PlayerInfo[playerid][pSprunk]);
INI_WriteInt(File,"WeaponLicense",PlayerInfo[playerid][pWeaponLicense]);
INI_WriteInt(File,"WalkStyle",PlayerInfo[playerid][pWalkStyle]);
INI_WriteInt(File,"Ingredients",PlayerInfo[playerid][pIngredients]);
printf("DEBUG: INI_WriteInt() (PlayerAttachmentInfo)");
for(new i = 0; i < MAX_PLAYERATTACHMENTS; i++)
{
format(szField, sizeof(szField), "pa%dModelID", i);
INI_WriteInt(File,szField,PlayerAttachmentInfo[playerid][i][paModelID]);
format(szField, sizeof(szField), "pa%dBone", i);
INI_WriteInt(File,szField,PlayerAttachmentInfo[playerid][i][paBone]);
format(szField, sizeof(szField), "pa%dPosX", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paPosX]);
format(szField, sizeof(szField), "pa%dPosY", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paPosY]);
format(szField, sizeof(szField), "pa%dPosZ", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paPosZ]);
format(szField, sizeof(szField), "pa%dRotX", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotX]);
format(szField, sizeof(szField), "pa%dRotY", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotY]);
format(szField, sizeof(szField), "pa%dRotZ", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotZ]);
format(szField, sizeof(szField), "pa%dScaleX", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotX]);
format(szField, sizeof(szField), "pa%dScaleY", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotY]);
format(szField, sizeof(szField), "pa%dScaleZ", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotZ]);
}
INI_WriteInt(File,"Meth",PlayerInfo[playerid][pHeroin]);
printf("DEBUG: INI_Close()");
INI_Close(File);
return 1;
}
public LoadUser_data(playerid,name[],value[])
{
new szField[128];
if(DebugEnabled == 1) { printf("DEBUG: LoadUser_data(%d, %s, %s)", playerid, name, value); }
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("AdminDivision",PlayerInfo[playerid][pAdminDivision]);
INI_Int("SecKey",PlayerInfo[playerid][pSecKey]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Float("FacingAngle",PlayerInfo[playerid][pFacingAngle]);
INI_Float("Health",PlayerInfo[playerid][pHealth]);
INI_Float("Armour",PlayerInfo[playerid][pArmour]);
INI_Float("LastX", PlayerInfo[playerid][pLastX]);
INI_Float("LastY", PlayerInfo[playerid][pLastY]);
INI_Float("LastZ", PlayerInfo[playerid][pLastZ]);
INI_Int("Jailed",PlayerInfo[playerid][pJailed]);
INI_Int("JailTime",PlayerInfo[playerid][pJailTime]);
INI_String("JailReason",PlayerInfo[playerid][pJailReason], 32);
INI_String("JailedBy",PlayerInfo[playerid][pJailedBy], MAX_PLAYER_NAME);
INI_Int("Banned",PlayerInfo[playerid][pBanned]);
INI_String("BanReason",PlayerInfo[playerid][pBanReason], 50);
INI_String("IP",PlayerInfo[playerid][pIP], 32);
INI_Int("Faction",PlayerInfo[playerid][pFaction]);
INI_Int("FactionRank",PlayerInfo[playerid][pFactionRank]);
INI_Int("FactionDivision",PlayerInfo[playerid][pFactionDivision]);
INI_Int("Registered",PlayerInfo[playerid][pRegistered]);
INI_Int("Bank",PlayerInfo[playerid][pBank]);
INI_String("Warrant",PlayerInfo[playerid][pWarrant], 50);
INI_Int("Wanted",PlayerInfo[playerid][pWanted]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Int("Sex",PlayerInfo[playerid][pSex]);
INI_String("pOrigin",PlayerInfo[playerid][pOrigin], 50);
INI_Int("Job",PlayerInfo[playerid][pJob]);
INI_Int("HouseKey",PlayerInfo[playerid][pHouseKey]);
INI_Int("Renting",PlayerInfo[playerid][pRenting]);//
INI_Int("ReportMuted",PlayerInfo[playerid][pReportMuted]);
INI_Int("PhoneNumber",PlayerInfo[playerid][pPhoneNumber]);
INI_Int("Cheque",PlayerInfo[playerid][pCheque]);
INI_Int("DrivingLicense",PlayerInfo[playerid][pDrivingLicense]);
INI_Int("Arrested",PlayerInfo[playerid][pArrested]);
INI_Int("Crimes",PlayerInfo[playerid][pCrimes]);
INI_Int("Hospital",PlayerInfo[playerid][pHospital]);
INI_Int("PayDay",PlayerInfo[playerid][pPayDay]);
INI_Int("BusinessKey",PlayerInfo[playerid][pBusinessKey]);
INI_Int("Cigar",PlayerInfo[playerid][pCigar]);
for(new i = 0; i < 12; i++)
{
format(szField, sizeof(szField), "Weapon%d", i);
INI_Int(szField,PlayerInfo[playerid][pWeapon][i]);
}
for(new i = 0; i < 12; i++)
{
format(szField, sizeof(szField), "Weaponammo%d", i);
INI_Int(szField,PlayerInfo[playerid][pWeapona][i]);
}
INI_Int("Radio",PlayerInfo[playerid][pRadio]);
INI_Int("RadioFreq",PlayerInfo[playerid][pRadioFreq]);
INI_Int("Donator",PlayerInfo[playerid][pDonator]);
INI_Int("DonatorTime",PlayerInfo[playerid][pDonatorTime]);
INI_Int("Sprunk",PlayerInfo[playerid][pSprunk]);
INI_Int("WeaponLicense",PlayerInfo[playerid][pWeaponLicense]);
INI_Int("WalkStyle",PlayerInfo[playerid][pWalkStyle]);
INI_Int("Ingredients",PlayerInfo[playerid][pIngredients]);
for(new i = 0; i < MAX_PLAYERATTACHMENTS; i++)
{
format(szField, sizeof(szField), "pa%dModelID", i);
INI_Int(szField,PlayerAttachmentInfo[playerid][i][paModelID]);
format(szField, sizeof(szField), "pa%dBone", i);
INI_Int(szField,PlayerAttachmentInfo[playerid][i][paBone]);
format(szField, sizeof(szField), "pa%dPosX", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paPosX]);
format(szField, sizeof(szField), "pa%dPosY", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paPosY]);
format(szField, sizeof(szField), "pa%dPosZ", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paPosZ]);
format(szField, sizeof(szField), "pa%dRotX", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paRotX]);
format(szField, sizeof(szField), "pa%dRotY", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paRotY]);
format(szField, sizeof(szField), "pa%dRotZ", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paRotZ]);
format(szField, sizeof(szField), "pa%dScaleX", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paScaleX]);
format(szField, sizeof(szField), "pa%dScaleY", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paScaleY]);
format(szField, sizeof(szField), "pa%dScaleZ", i);
INI_Float(szField,PlayerAttachmentInfo[playerid][i][paScaleZ]);
}
INI_Int("Meth",PlayerInfo[playerid][pHeroin]);
return 1;
}
public OnPlayerConnect(playerid)
{
...
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialogEx(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome back to CHANGEME.\n\nThat name is registered. Please enter your password below.","Login","Quit"); //login
format(string, sizeof(string), ""COL_WHITE"Welcome back to "COL_YELLOW"CHANGEME, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
SendClientMessage(playerid, -1, string);
}
else
{
ShowPlayerDialogEx(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register","Welcome to CHANGEME.\n\nPlease register your account by typing the password below.","Register","Quit");
format(string, sizeof(string), ""COL_WHITE"Welcome to "COL_YELLOW"CHANGEME, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
SendClientMessage(playerid, -1, string);
}
...
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER)
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialogEx(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register","Welcome to CHANGEME.\n\nPlease register your account by typing the password below.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid)), szField[128];
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash] = 0);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin] = 0);
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel] = 0);
INI_WriteInt(File,"Int",PlayerInfo[playerid][pInt] = 0);
INI_WriteInt(File,"VW",PlayerInfo[playerid][pVW] = 0);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin] = 0);
INI_WriteInt(File,"AdminDivision",PlayerInfo[playerid][pAdminDivision] = 0);
INI_WriteInt(File,"SecKey",PlayerInfo[playerid][pSecKey] = 0);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills] = 0);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths] = 0);
INI_WriteFloat(File,"FacingAngle",PlayerInfo[playerid][pFacingAngle] = 0);
INI_WriteFloat(File,"Health",PlayerInfo[playerid][pHealth] = 0);
INI_WriteFloat(File,"Armour",PlayerInfo[playerid][pArmour] = 0);
INI_WriteFloat(File,"LastX",PlayerInfo[playerid][pLastX] = 0);
INI_WriteFloat(File,"LastY",PlayerInfo[playerid][pLastY] = 0);
INI_WriteFloat(File,"LastZ",PlayerInfo[playerid][pLastZ] = 0);
INI_WriteInt(File,"Jailed",PlayerInfo[playerid][pJailed] = 0);
INI_WriteInt(File,"JailTime",PlayerInfo[playerid][pJailTime] = 0);
INI_WriteString(File,"JailReason","");
INI_WriteString(File,"JailedBy","");
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned] = 0);
INI_WriteString(File,"BanReason","");
INI_WriteString(File,"IP",GetPlayerIpEx(playerid));
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction] = 0);
INI_WriteInt(File,"FactionRank",PlayerInfo[playerid][pFactionRank] = 0);
INI_WriteInt(File,"FactionDivision",PlayerInfo[playerid][pFactionDivision] = 0);
INI_WriteInt(File,"Registered",PlayerInfo[playerid][pRegistered] = 0);
INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank] = 0);
INI_WriteString(File,"Warrant","");
INI_WriteInt(File,"Wanted",PlayerInfo[playerid][pWanted] = 0);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge] = 0);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex] = 0);
INI_WriteString(File,"Origin","");
INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob] = 0);
INI_WriteInt(File,"HouseKey",PlayerInfo[playerid][pHouseKey] = INVALID_HOUSE_ID);
INI_WriteInt(File,"Renting",PlayerInfo[playerid][pRenting] = INVALID_HOUSE_ID);
INI_WriteInt(File,"ReportMuted",PlayerInfo[playerid][pReportMuted] = 0);
INI_WriteInt(File,"PhoneNumber",PlayerInfo[playerid][pPhoneNumber] = 0);
INI_WriteInt(File,"Cheque",PlayerInfo[playerid][pCheque] = 0);
INI_WriteInt(File,"DrivingLicense",PlayerInfo[playerid][pDrivingLicense] = 0);
INI_WriteInt(File,"Arrested",PlayerInfo[playerid][pArrested] = 0);
INI_WriteInt(File,"Crimes",PlayerInfo[playerid][pCrimes] = 0);
INI_WriteInt(File,"Hospital",PlayerInfo[playerid][pHospital] = 0);
INI_WriteInt(File,"PayDay",PlayerInfo[playerid][pPayDay] = 0);
INI_WriteInt(File,"BusinessKey",PlayerInfo[playerid][pBusinessKey] = INVALID_BUSINESS_ID);
INI_WriteInt(File,"Cigar",PlayerInfo[playerid][pCigar] = 0);
for(new i = 0; i < 12; i++)
{
format(szField, sizeof(szField), "Weapon%d", i);
INI_WriteInt(File,szField,PlayerInfo[playerid][pWeapon][i] = 0);
}
for(new i = 0; i < 12; i++)
{
format(szField, sizeof(szField), "Weaponammo%d", i);
INI_WriteInt(File,szField,PlayerInfo[playerid][pWeapona][i] = 0);
}
INI_WriteInt(File,"Radio",PlayerInfo[playerid][pRadio] = 0);
INI_WriteInt(File,"RadioFreq",PlayerInfo[playerid][pRadioFreq] = 0);
INI_WriteInt(File,"Donator",PlayerInfo[playerid][pDonator] = 0);
INI_WriteInt(File,"DonatorTime",PlayerInfo[playerid][pDonatorTime] = 0);
INI_WriteInt(File,"Sprunk",PlayerInfo[playerid][pSprunk] = 0);
INI_WriteInt(File,"WeaponLicense",PlayerInfo[playerid][pWeaponLicense] = 0);
INI_WriteInt(File,"WalkStyle",PlayerInfo[playerid][pWalkStyle] = 0);
INI_WriteInt(File,"Ingredients",PlayerInfo[playerid][pIngredients] = 0);
for(new i = 0; i < MAX_PLAYERATTACHMENTS; i++)
{
format(szField, sizeof(szField), "pa%dModelID", i);
INI_WriteInt(File,szField,PlayerAttachmentInfo[playerid][i][paModelID] = 0);
format(szField, sizeof(szField), "pa%dBone", i);
INI_WriteInt(File,szField,PlayerAttachmentInfo[playerid][i][paBone] = 0);
format(szField, sizeof(szField), "pa%dPosX", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paPosX] = 0);
format(szField, sizeof(szField), "pa%dPosY", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paPosY] = 0);
format(szField, sizeof(szField), "pa%dPosZ", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paPosZ] = 0);
format(szField, sizeof(szField), "pa%dRotX", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotX] = 0);
format(szField, sizeof(szField), "pa%dRotY", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotY] = 0);
format(szField, sizeof(szField), "pa%dRotZ", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotZ] = 0);
format(szField, sizeof(szField), "pa%dScaleX", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotX] = 0);
format(szField, sizeof(szField), "pa%dScaleY", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotY] = 0);
format(szField, sizeof(szField), "pa%dScaleZ", i);
INI_WriteFloat(File,szField,PlayerAttachmentInfo[playerid][i][paRotZ] = 0);
}
INI_WriteInt(File,"Meth",PlayerInfo[playerid][pHeroin] = 0);
INI_Close(File);
SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you have been logged in automatically.");
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", GetName(playerid));
GameTextForPlayer(playerid, tmp2, 5000, 1);
new WelcomeString[500];
format(tmp2, sizeof(tmp2), "Welcome to CHANGEME, %s.\n", GetName(playerid));
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
format(tmp2, sizeof(tmp2), "Please take your time to read the tutorial as you will need to answer questions based on what to answer questions based on what the tutorial says.\n");
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
format(tmp2, sizeof(tmp2), "then after the questions, you'll be taken to character setup.\n");
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
format(tmp2, sizeof(tmp2), "We hope you enjoy your time here at CHANGEME.");
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
ShowPlayerDialogEx(playerid,DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Registration", WelcomeString, "Okay", "Quit");
}
}
else if(dialogid == 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);
if(PlayerInfo[playerid][pRegistered] == 0)
{
new WelcomeString[500];
format(tmp2, sizeof(tmp2), "Welcome to CHANGEME, %s.\n", GetName(playerid));
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
format(tmp2, sizeof(tmp2), "Please take your time to read the tutorial as you will need to answer questions based on what to answer questions based on what the tutorial says.\n");
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
format(tmp2, sizeof(tmp2), "then after the questions, you'll be taken to character setup.\n");
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
format(tmp2, sizeof(tmp2), "We hope you enjoy your time here at CHANGEME.");
strcat(WelcomeString, tmp2, sizeof(WelcomeString));
ShowPlayerDialogEx(playerid,DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Registration", WelcomeString, "Okay", "Quit");
return 1;
}
SetPlayerColour(playerid);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], PlayerInfo[playerid][pFacingAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
new plrIP[32];
GetPlayerIp(playerid,plrIP, sizeof(plrIP));
format(PlayerInfo[playerid][pIP], 32, "%s", plrIP);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetHealth(playerid, PlayerInfo[playerid][pHealth]);
SetArmour(playerid, PlayerInfo[playerid][pArmour]);
SetInterior(playerid, PlayerInfo[playerid][pInt]);
SetVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", GetName(playerid));
GameTextForPlayer(playerid, tmp2, 5000, 1);
SendClientMessage(playerid, COLOR_YELLOW, GlobalMOTD);
TogglePlayerSpectating(playerid, 0);
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(tmp2, sizeof(tmp2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,tmp2);
ShowPlayerDialogEx(playerid, DIALOG_ADMIN,DIALOG_STYLE_INPUT,"Admin Login","Please provide your security code for your admin account to be authorized.\n\nPlease enter your security code below.","Login","Quit"); //admin authorization
}
if(PlayerInfo[playerid][pDonatorTime] > 0 && (1 <= PlayerInfo[playerid][pDonator] <= 3) && (PlayerInfo[playerid][pDonatorTime] - gettime() < 0))
{
format(string, sizeof(string), "[{FF6347}Admin Warning{FFFF00}] Please check person %s as their VIP may have expired.", GetName(playerid));
SendAdminMessage(COLOR_LIGHTRED, string, 5);
PlayerInfo[playerid][pDonator] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "Your Donator statu has expired.");
}
if(PlayerInfo[playerid][pDonator] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You are logged in as a {BE5900}Bronze Donator{FFFFFF}.");
if(PlayerInfo[playerid][pDonatorTime] > 0 && (PlayerInfo[playerid][pDonatorTime] - 259200 < gettime()) )
{
SendClientMessage(playerid, COLOR_RED, "Your Donator Status is due to expire soon, renew to further enjoy Donator features");
}
}
else if(PlayerInfo[playerid][pDonator] == 2)
{
SendClientMessage(playerid, COLOR_WHITE, "You are logged in as a {C0C0C0}Silver Donator{FFFFFF}.");
if(PlayerInfo[playerid][pDonatorTime] > 0 && (PlayerInfo[playerid][pDonatorTime] - 259200 < gettime()) )
{
SendClientMessage(playerid, COLOR_RED, "Your Donator Status is due to expire soon, renew to further enjoy Donator features");
}
}
else if(PlayerInfo[playerid][pDonator] == 3)
{
SendClientMessage(playerid, COLOR_WHITE, "You are logged in as a {FFD700}Gold Donator{FFFFFF}.");
if(PlayerInfo[playerid][pDonatorTime] > 0 && (PlayerInfo[playerid][pDonatorTime] - 259200 < gettime()) )
{
SendClientMessage(playerid, COLOR_RED, "Your Donator Status is due to expire soon, renew to further enjoy Donator features");
}
}
if(PlayerInfo[playerid][pDonator] > 3)
{
PlayerInfo[playerid][pDonator] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "Your Donator Status has been removed as you had a invalid level.");
}
SendClientMessage(playerid, COLOR_GRAD1, "Want to avoid losing your stats? Type /saveaccount to save your precious stats.");
}
else
{
if(PasswordAttempts[playerid] == 3)
{
SendClientMessage(playerid, COLOR_WHITE,"You have typed the incorrect password too many times.");
Kick(playerid);
}
PasswordAttempts[playerid]++;
ShowPlayerDialogEx(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome back to CHANGEME.\n\nThat name is registered. Please enter your password below.","Login","Quit");
}
return 1;
}
}
return 1;
}