Dini saving to file
#1

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?
Reply
#2

Код:
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.
Reply
#3

Anymore help?
Reply
#4

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

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!
Reply
#6

Not Working. Still 0.
Reply
#7

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

if it doesnt work so tell me
Reply
#8

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

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]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)