INI_WriteInt causes "Invalid instruction" run time error
#1

My code:
pawn Код:
print("SetServerData called");
    new INI:file = INI_Open(#SERVER_DATA_FILE_NAME ".ini");
    print("File opened");
    INI_SetTag(file, "Misc");
    print("Tag set");
    INI_WriteInt(file, GetServerElementName(key), value);
    print("Int written");
    INI_Close(file);
Function GetServerElementName returns "LastJobXpWipeTimestamp".


Код:
[16:31:56] SetServerData called
[16:31:56] File opened
[16:31:56] Tag set
[16:31:56] [debug] Run time error 6: "Invalid instruction"
[16:31:56] [debug]  Unknown opcode 0x103f3c6 at address 0x00000031
[16:31:56] [debug] AMX backtrace:
[16:31:56] [debug] #0 00000031 in ?? () at F:\AAAA\server\pawno\include\float.inc:108
[16:31:56] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[16:31:56] [debug] #2 00003274 in Command_Add () at F:\AAAA\server\pawno\include\YSI\y_iterate.inc:791
[16:31:56] [debug] #3 00001e94 in Command_Add () at F:\AAAA\server\pawno\include\YSI\internal\..\y_scriptinit.inc:171
Reply
#2

bump
Reply
#3

bump
Reply
#4

Quote:

"LastJobXpWipeTimestamp"

Is that a string or a variable?

If it's a string, you should be using INI_WriteString.
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Is that a string or a variable?

If it's a string, you should be using INI_WriteString.
Yes it's a string but its the name of the key. The value is an integer.
Reply
#6

Mind if I see the GetServerElementName function?

EDIT: And lol, I just realised that it was the key name.
Reply
#7

Ofcourse if you think it's needed
pawn Код:
GetServerElementName(E_SERVER_DATA: element)
{
    new str[32];
    switch(element)
    {
        case OnlineRecord:          str = "OnlineRecord";
        case LastJobXpWipeTimestamp:str = "LastJobXpWipeTimestamp";
    }
    return str;
}
It simply returns a key string for the appropriate element


Also, I'm not sure how this can happen but I get a different run time error when I launch it on Linux:
pawn Код:
[01:25:45] [debug] AMX backtrace:
[01:25:45] [debug] #0 00000031 in INI_AddToBuffer (INI:file=53, name[]=@00000000 "", data[]=@0141d7f4 "0000001418513145") at <unknown file>:0
[01:25:45] [debug] #1 000a53d0 in ?? (... <13 arguments>) at F:\AAAA\server\pawno\include\YSI\internal\..\y_ini.inc:1076
[01:25:45] [debug] #2 00000031 in public TimedTasks () at <unknown file>:0
This should be more useful.
Reply
#8

Strange... it works fine for me. Can you show me where you retrieve the values for 'key' and 'value'?
Reply
#9

Strange indeed.

This works:
pawn Код:
SetServerData(LastJobXpWipeTimestamp, 454);
This does not.
pawn Код:
SetServerData(LastJobXpWipeTimestamp, gettime());

To rule out other factors, this also produces an error:
pawn Код:
new INI:file = INI_Open("Lol.txt");
    INI_WriteInt(file, "Key",gettime());
    INI_Close(file);
Although a different one:
pawn Код:
[17:31:26] [debug] Run time error 4: "Array index out of bounds"
[17:31:26] [debug]  Accessing element at index 21092424 past array upper bound 499
[17:31:26] [debug] AMX backtrace:
[17:31:26] [debug] #0 0001ccb8 in ?? () from server.amx
[17:31:26] [debug] #1 000962cc in public Itter_OnGameModeInit () from server.amx
[17:31:26] [debug] #2 native CallLocalFunction () [00472ad0] from samp-server.exe
[17:31:26] [debug] #3 00002de8 in ?? () from server.amx
[17:31:26] [debug] #4 00001d6c in public OnGameModeInit () from server.amx
Reply
#10

It seems like you're using gettime in an array of MAX_PLAYERS? 0_o

Example:
pawn Код:
#define MAX_VARS 500
new Variable[MAX_VARS];

public OnGameModeInit()
{
    Variable[gettime()] = 1;
    return 1;
}
Do you have anything that could trigger this same effect?

EDIT: Not necessarily 'gettime', but something that produces a large number.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)