SA-MP Forums Archive
[Dini] INI-files easy! (1.6, 16th Sep 2008) - 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)
+--- Thread: [Dini] INI-files easy! (1.6, 16th Sep 2008) (/showthread.php?tid=50)

Pages: 1 2


Re: [Dini] INI-files easy! - Tratulla - 01.09.2006

Hey all!

I've got this dini file working properly under windows, but as soon as I upload my gamemode to my dedicated server it wont start again.

I'll get this error:
Code:
samp01b: amx/amxfile.c:536: n_fputchar: Assertion `result==0 || result==1' failed.
And that err will be called as soon as dini_Set is called.

Is there a bug in the function?

Regards,
Peter


Re: [Dini] INI-files easy! - DracoBlue - 01.09.2006

Ah, this is an issue with the "fputchar" of samp. If you want to fix it your self, replace the
pawn Code:
fputchar(fhnd,13);
fputchar(fhnd,10);
with
pawn Code:
fwrite(fhnd,"\r\n");

Are you sure you use 1.2? It is already fixed in this release!



Re: [Dini] INI-files easy! - Tratulla - 01.09.2006

I've fixxed it!

The problem was in dutils at fcopy, wich is called by frename, wich is called by dini_Set

I've replaced:
Code:
 new buf2[1];
 new i;
 for (i=flength(ohnd);i>0;i--) {
  fputchar(nhnd, fgetchar(ohnd, buf2[0],false),false);
 }
with:

Code:
new tmpres[MAX_STRING];
 tmpres[0]=0;
 while (fread(ohnd,tmpres)) {
  StripNewLine(tmpres);
  fwrite(nhnd,tmpres);
  fwrite(nhnd,"\r\n");
 }
So you might want to update dutils

Thanks!


Re: [Dini] INI-files easy! - DracoBlue - 01.09.2006

thanks! so we got the evil one


Re: [Dini] INI-files easy! - Crazycamel - 30.09.2006

lol me again.

im trying to make it so that people can register there email address on the server but im getting these errors
Code:
C:\Documents and Settings\Patrick\Desktop\niko.pwn(432) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Patrick\Desktop\niko.pwn(433) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\Patrick\Desktop\niko.pwn(449) : warning 204: symbol is assigned a value that is never used: "email"
Pawn compiler 3.0.3367			Copyright © 1997-2005, ITB CompuPhase
my code is
Code:
	if(strcmp(cmd, "/register", true)==0) {
		new tmp[562];
		tmp = strtok(cmdtext, idx);
		
		if(!strlen(tmp)) {
		  SendClientMessage(playerid, RED, "USAGE: /register [password] [email]");
		  return 1;
		  }

		password = strval(tmp);
		tmp = strtok(cmdtext, idx);
		
		if(!strlen(tmp)) {
		  SendClientMessage(playerid, RED, "USAGE: /register [password] [email]");
		  return 1;
		  }

		email = strval(tmp);
		
		GetPlayerName(playerid, playername, sizeof(playername));
		
		if(logged[playerid] != 1) {
		  if(!dini_Exists(udb_encode(playername))) {
		    dini_Create(udb_encode(playername));
		    dini_IntSet(udb_encode(playername), "password", udb_hash(password));
		    dini_Set(udb_encode(playername), "email", email);
		    format(string, sizeof(string), "You have successfully registered the password %s you are now logged in", password);
		    SendClientMessage(playerid, LIGHTBLUE, string);
		    logged[playerid] = 1;
		    return 1;
		  } else {
		    SendClientMessage(playerid, RED, "Nick already registered");
		    return 1;
		  }
		  } else {
		    SendClientMessage(playerid, RED, "You are already logged in");
		    return 1;
			}
	return 1;
}
lines 432 and 433 are
Code:
		    dini_IntSet(udb_encode(playername), "password", udb_hash(password));
		    dini_Set(udb_encode(playername), "email", email);
thanx if you can help me fix this


Re: [Dini] INI-files easy! - DracoBlue - 30.09.2006

the vars password and email have wrong type.

remove the password = strval(tmp); stuff and declare it with new password[MAX_STRING]; and use password=tmp;


Re: [Dini] INI-files easy! - Crazycamel - 30.09.2006

now i get
Code:
C:\Documents and Settings\Patrick\Desktop\niko.pwn(418) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Patrick\Desktop\niko.pwn(426) : error 047: array sizes do not match, or destination array is too small



Re: [Dini] INI-files easy! - DracoBlue - 30.09.2006

show the source of this part, please


Re: [Dini] INI-files easy! - Crazycamel - 30.09.2006

Code:
	if(strcmp(cmd, "/register", true)==0) {
		new tmp[562];
		tmp = strtok(cmdtext, idx);
		
		if(!strlen(tmp)) {
		  SendClientMessage(playerid, RED, "USAGE: /register [password] [email]");
		  return 1;
		  }

		password = tmp;
		tmp = strtok(cmdtext, idx);
		
		if(!strlen(tmp)) {
		  SendClientMessage(playerid, RED, "USAGE: /register [password] [email]");
		  return 1;
		  }

		email = tmp;
		
		GetPlayerName(playerid, playername, sizeof(playername));
		
		if(logged[playerid] != 1) {
		  if(!dini_Exists(udb_encode(playername))) {
		    dini_Create(udb_encode(playername));
		    dini_IntSet(udb_encode(playername), "password", udb_hash(password));
		    dini_Set(udb_encode(playername), "email", email);
		    format(string, sizeof(string), "You have successfully registered the password %s you are now logged in", password);
		    SendClientMessage(playerid, LIGHTBLUE, string);
		    logged[playerid] = 1;
		    return 1;
		  } else {
		    SendClientMessage(playerid, RED, "Nick already registered");
		    return 1;
		  }
		  } else {
		    SendClientMessage(playerid, RED, "You are already logged in");
		    return 1;
			}
	return 1;
}
Code:
	new password[MAX_STRING];
	new email[MAX_STRING];
Code:
C:\Documents and Settings\Patrick\Desktop\niko.pwn(418) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Patrick\Desktop\niko.pwn(426) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.0.3367			Copyright © 1997-2005, ITB CompuPhase


2 Errors.



Re: [Dini] INI-files easy! - DracoBlue - 30.09.2006

replace new tmp[562]; with new tmp[MAX_STRING];


Re: [Dini] INI-files easy! (1.6, 16th Sep 2008) - Brezon - 11.07.2014

Download link is already mentioned in the first page and its working.
Edit: Sorry for Bump