02.11.2010, 08:42
I seem to have found a bug with reading large strings before the server is restarted. For example if i used a register command it would save the password to a file good, but when i try to read that password it returns null untill the server is restarted. Here is some example code.
Output on first execution
Output after restart (same code)
I don't understand why this is happening it works fine for small strings and i checked the max string in the include is 255. If anyone can help it would be much appreciated.
pawn Код:
#include <a_samp>
#include <djson>
forward testtimer();
new count, t_timer;
main()
{
new str[129];//below is my name hashed with whirlpool (129 cells)
format(str, sizeof(str), "362C5AE16755FB404B2C5B507522AE358F1DB630EBAE9836422E8C2E9FCAC537BA08A2EEF982CBBDAFFFC5D72F9595AF22400C1C0FEAD955FDA22ADC9916511D");
djSet("test.json","test/pass",str);
t_timer = SetTimer("testtimer",2000,true);
}
public OnGameModeInit(){djson_GameModeInit();return 1;}
public OnGameModeExit(){djson_GameModeExit();return 1;}
public testtimer()
{
count ++;
if(count == 5)KillTimer(t_timer);
printf("attempt %d\n%s", count, dj("test.json","test/pass"));
}
Код:
[08:37:59] --------------- [08:37:59] Loaded 0 filter scripts. [08:37:59] Number of vehicle models: 0 [08:38:01] attempt 1 [08:38:03] attempt 2 [08:38:05] attempt 3 [08:38:08] attempt 4 [08:38:10] attempt 5 [08:38:28] --- Server Shutting Down.
Код:
[08:44:34] --------------- [08:44:34] Loaded 0 filter scripts. [08:44:34] Number of vehicle models: 0 [08:44:36] attempt 1 362C5AE16755FB404B2C5B507522AE358F1DB630EBAE9836422E8C2E9FCAC537BA08A2EEF982CBBDAFFFC5D72F9595AF22400C1C0FEAD955FDA22ADC9916511D [08:44:39] attempt 2 362C5AE16755FB404B2C5B507522AE358F1DB630EBAE9836422E8C2E9FCAC537BA08A2EEF982CBBDAFFFC5D72F9595AF22400C1C0FEAD955FDA22ADC9916511D [08:44:41] attempt 3 362C5AE16755FB404B2C5B507522AE358F1DB630EBAE9836422E8C2E9FCAC537BA08A2EEF982CBBDAFFFC5D72F9595AF22400C1C0FEAD955FDA22ADC9916511D [08:44:43] attempt 4 362C5AE16755FB404B2C5B507522AE358F1DB630EBAE9836422E8C2E9FCAC537BA08A2EEF982CBBDAFFFC5D72F9595AF22400C1C0FEAD955FDA22ADC9916511D [08:44:46] attempt 5 362C5AE16755FB404B2C5B507522AE358F1DB630EBAE9836422E8C2E9FCAC537BA08A2EEF982CBBDAFFFC5D72F9595AF22400C1C0FEAD955FDA22ADC9916511D [08:45:32] --- Server Shutting Down.