27.03.2014, 16:46
I need to check if a function is defined(for an include). So I wrote this code:
And a backtrace from crashdetect:
I used the function in OnGameModeInit hook:
I left those prints there for a reason. This is the last thing printed out before "Native function failed":
Which is just before calling the function "fcreate"
If I remove the #if !defined part, it runs just like it should. But this is not a sollution.
All ideas will be appreciated
pawn Код:
#if !defined fcreate
stock fcreate(const filename[])
{
printf("Fcreatea: start");
if(!fexist(filename))
{
printf("Fcreatea: the file does Not exist");
new File:file = fopen(filename,io_write);
printf("Fcreatea: file opened");
return fclose(file);
}
return 0;
}
#endif
pawn Код:
[18:49:49] [debug] Run time error 10: "Native function failed"
[18:49:49] [debug] fread
[18:49:49] [debug] AMX backtrace:
[18:49:49] [debug] #0 00000c50 in public OnGameModeInit () from speed.amx
pawn Код:
printf("File does NOT exist");
fcreate(BAN_FILE_NAME);
pawn Код:
[18:49:49] File does NOT exist
If I remove the #if !defined part, it runs just like it should. But this is not a sollution.
All ideas will be appreciated