20.07.2010, 20:46
I have problem in my code that I have tried to solve for a long time now but can't really fix it.
So, I need your help fixing them.
I use "dini" system to save player data to files. Here is a simple example on how I save the data.
The register command:
The values in the file remain 0 (zero) no matter what I do.
Can anyone give it a shot?
So, I need your help fixing them.
I use "dini" system to save player data to files. Here is a simple example on how I save the data.
Code:
enum data
{
Kills
};
Code:
new pinfo[MAX_PLAYERS][data];
Code:
public OnPlayerConnect(playerid)
{
new file[128];
format(file,128,"/20accounts/%s.ini",name(playerid));
if(fexist(file))
{
login(playerid);
}
return 1;
}
Code:
login(playerid)
{
new file[128];
format(file,128,"/20accounts/%s.ini",name(playerid));
pinfo[playerid][Kills] = dini_Int(file,"Kills");
return 1;
}
Code:
public OnPlayerDeath(playerid,killerid,reason)
{
pinfo[killerid][Kills]++;
return 1;
}
Code:
public OnPlayerDisconnect(playerid,reason)
{
new file[128];
format(file,128,"/20accounts/%s.ini",name(playerid));
dini_IntSet(file, "Kills", pinfo[playerid][Kills]);
return 1;
}
Code:
if(!strcmp(cmdtext,"/register",true))
{
new file[128];
format(file,128,"/20accounts/%s.ini",name(playerid));
dini_Create(file);
dini_IntSet(file, "Kills", pinfo[playerid][Kills]);
return 1;
}
Can anyone give it a shot?

