[Dini] INI-files easy! (1.6, 16th Sep 2008)
#21

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
Reply
#22

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

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

thanks! so we got the evil one
Reply
#25

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
Reply
#26

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;
Reply
#27

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
Reply
#28

show the source of this part, please
Reply
#29

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.
Reply
#30

replace new tmp[562]; with new tmp[MAX_STRING];
Reply
#31

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


Forum Jump:


Users browsing this thread: 1 Guest(s)