SA-MP Forums Archive
Dini saving to file - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dini saving to file (/showthread.php?tid=114633)



Dini saving to file - Ironboy500 - 20.12.2009

ok I need help with dudb. I will show you parts of my admin FS:

Part of /register
Код:
if(!fexist(file))
			{
			  dini_Create(file);
			  dini_IntSet(file, "Password", udb_hash(tmp));
			  dini_IntSet(file,"AdminLevel", 0);
			  dini_IntSet(file,"Cash", 0);
		    dini_IntSet(file,"Kills", 0);
	      dini_IntSet(file,"Deaths", 0);
        dini_IntSet(file,"VIP", 0);
			  SendClientMessage(playerid, 0xFFA500FF, "Server: Account succesfully created, than you!");
			  PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
			  GetPlayerName(playerid, name, sizeof(name));
			  printf("%s has registered a account!", name);
			}
OK here is disconnect:
Код:
new string[256], pname[MAX_PLAYER_NAME]; new file[128];
	format (file, sizeof(file), "%s.ini", pname);
	GetPlayerName(playerid, pname, sizeof(pname));
	format(string, sizeof(string), "2%s has left the server", pname);
	ircSay(EchoConnection, EchoChan, string);
	if(!fexist(file))
	{
	  dini_IntSet(file, "Kills",PlayerInfo[playerid][Kills]);
      dini_IntSet(file, "Deaths",PlayerInfo[playerid][Deaths]);
  }
}
it compiles with no errors but it is not saving Kills and Deaths in file. Any help?


Re: Dini saving to file - Rac3r - 20.12.2009

Код:
if(!fexist(file))
{
  printf("FindBug: File: %s  Kills: %d  Deaths: %d",file,PlayerInfo[playerid][Kills],,PlayerInfo[playerid][Deaths]);
  dini_IntSet(file, "Kills",PlayerInfo[playerid][Kills]);
  dini_IntSet(file, "Deaths",PlayerInfo[playerid][Deaths]);
}
From looking at your code, I don't see a problem. But your code is just part of the problem, try printing (above example) to make sure the file exists, to check the file name, to check kills and to check deaths. Printing helps you fix your own problems.


Re: Dini saving to file - Ironboy500 - 20.12.2009

Anymore help?


Re: Dini saving to file - Ironboy500 - 20.12.2009

Tried, not showing that text in samp-server.exe.


Re: Dini saving to file - Deat_Itself - 20.12.2009

pawn Код:
new MyKills[MAX_PLAYERS];
new MyDeaths[MAX_PLAYERS];
i doesnt know much about it but if you add this line in OnPlayerDeath
pawn Код:
MyDeaths[playerid]++;
MyKills[killerid]++;
if(MyKills[playerid] == ++ )//then add here your function of writing to folder
if(MyDeaths[killerid] == ++ ) //then add here your function of writing to folder
i doesnt checked this
something like that may help you!


Re: Dini saving to file - Ironboy500 - 20.12.2009

Not Working. Still 0.


Re: Dini saving to file - Deat_Itself - 20.12.2009

try this
http://forum.sa-mp.com/index.php?top...8334#msg748334

if it doesnt work so tell me


Re: Dini saving to file - LarzI - 20.12.2009

A simple mistake...
Remove the '!' from the last fexist check.
You don't wanna save if the file isn't found, lol.


Re: Dini saving to file - Rac3r - 20.12.2009

Quote:
Originally Posted by Ironboy500
Tried, not showing that text in samp-server.exe.
Ok, the file doesn't exist. Ignore all the death/kills code, because it looks like you have a problem creating accounts.
It ain't saving because the file doesn't exist, if it did, it would print to console.

Quote:
Originally Posted by lrZ^ aka LarzI
A simple mistake...
Remove the '!' from the last fexist check.
You don't wanna save if the file isn't found, lol.
Ahhhh.. Yes! Good find lol
Код:
if(fexist(file)) // he is right, remove the !
{
  printf("FindBug: File: %s  Kills: %d  Deaths: %d",file,PlayerInfo[playerid][Kills],,PlayerInfo[playerid][Deaths]);
  dini_IntSet(file, "Kills",PlayerInfo[playerid][Kills]);
  dini_IntSet(file, "Deaths",PlayerInfo[playerid][Deaths]);
}