23.10.2015, 09:13
Literally I feel stupidty, y_ini works prefectly in my gamemode, but it doesn't in my filterscript..
I trying to load/save an integer, it saves but, it doesn't even call the LoadUser stock..
Heres my codes.. I'm pretty sure theres no thing wrong in this code, Because I compared it with my gamemode ones its same..
LoadUser:
UserPath stock:
Path define:
OnPlayerConnect:
OnPlayerDisconnect:
I've added some debug strings as you can see, But it doesn't show
In LoadUser stock, So I can say, The stock isn't being called even...
What causes this? I checked my codes many time, I'm pretty sure theres nothing wrong with it so.. Probably a bug in y_ini?
I trying to load/save an integer, it saves but, it doesn't even call the LoadUser stock..
Heres my codes.. I'm pretty sure theres no thing wrong in this code, Because I compared it with my gamemode ones its same..
LoadUser:
PHP код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Police",Police[playerid]);
INI_Int("JailTime",JailTime[playerid]);
SendClientMessageToAll(-1, "User data loaded.");
return 1;
}
PHP код:
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),Path,playername);
return string;
}
PHP код:
#define Path "Police/%s.ini"
PHP код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SendClientMessageToAll(-1, "File exists, Called LoadUser.");
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
}
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"police");
INI_WriteInt(File,"Police",0);
INI_WriteInt(File,"JailTime",0);
INI_Close(File);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SendClientMessageToAll(-1, "File not exists, Created New file.");
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
}
return 1;
}
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"police");
INI_WriteInt(File,"Police",Police[playerid]);
INI_WriteInt(File,"JailTime",JailTime[playerid]);
INI_Close(File);
Police[playerid] = 0;
JailTime[playerid] = 0;
return 1;
}
PHP код:
SendClientMessageToAll(-1, "User data loaded.");
What causes this? I checked my codes many time, I'm pretty sure theres nothing wrong with it so.. Probably a bug in y_ini?