PDA

View Full Version : Y_Ini problem


austin070
28/08/2011, 02:59 AM
Sup guys? I can't seem to figure out why this is not working. Here is my code: #define USER_FILE "/Accounts/%s.ini"

stock UserFile(playerid)
{
new file[128];
format(file, sizeof(file), USER_FILE, GetPName(playerid));
return file;
}

switch(dialogid)
{
case 1:
{
if(!response) return Kick(playerid);
print("1");

if(!strlen(inputtext)) return ShowRegister(playerid);
print("2");
new INI:File = INI_Open(UserFile(playerid));
print("3");
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_Close(File);
print("4");
}
}

It stops at "print("2");" and I can't figure out why. Any insight?

dowster
28/08/2011, 03:14 AM
What is the stock/function for UserFile?

austin070
28/08/2011, 03:15 AM
It's the path to the user file.

Kingunit
28/08/2011, 03:46 AM
Try this


stock UserFile(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
format(string,sizeof(string),PATH,playername);
return string;
}

austin070
28/08/2011, 01:24 PM
Try this


stock UserFile(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
format(string,sizeof(string),PATH,playername);
return string;
}



Hmm this worked. Thanks. I don't understand why mine didn't work because I have playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e)); in my own function (GetPName(playerid)).

Kush
28/08/2011, 02:04 PM
And this is the reason you don't strip and replace.