27.02.2014, 20:12
So, i followed that tutorial, but my console crashes after I log in and type something, and the logs are still empty.
This is what I have in my script (exactly this order):
And this is my crash info:
What's wrong here? I can't figure out. Maybe I ommited something in the tutorials. Please help me.
This is what I have in my script (exactly this order):
Код:
#include <file>
Код:
forward ChatLog(chattext[]);
Код:
public ChatLog(chattext[]) { new entry[300],day,month,year,second,hour,minute, File:hFile; gettime(hour,minute,second); getdate(year,month,day); format(entry,sizeof(entry),"[%02d/%02d/%04d %02d:%02d:%02d] %s\n",day, month, year, hour, minute, second, chattext); hFile = fopen("Logs/chat.txt",io_append); fwrite(hFile,entry); fclose(hFile); }
Код:
public OnPlayerText(playerid, text[]) { new textv2[128], pname[25], Float:x, Float:y, Float:z, chattext[300]; GetPlayerName(playerid,pname,24); GetPlayerPos(playerid,x,y,z); format(textv2,sizeof(textv2), "%s says: %s", pname, text); for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerInRangeOfPoint(i,100.0,x,y,z)) { SendClientMessage(i,COL_WHITE,textv2); format(chattext,sizeof(chattext),"%s",textv2); ChatLog(chattext); } } return 0; }
Код:
[23:14:57] Incoming connection: 127.0.0.1:54308 [23:14:57] [join] BlackThief has joined the server (0:127.0.0.1) [23:15:03] [debug] Server crashed while executing test0.1.amx [23:15:03] [debug] AMX backtrace: [23:15:03] [debug] #0 native fwrite () [004056e0] from samp-server.exe [23:15:03] [debug] #1 000096d4 in public ChatLog (0x0002f770) from test0.1.amx [23:15:03] [debug] #2 0000c34c in public OnPlayerText (0x00000000, 0x0002bea8) from test0.1.amx [23:15:03] [debug] Native backtrace: [23:15:03] [debug] #0 77ed3632 in ?? () from C:\Windows\SYSTEM32\ntdll.dll [23:15:03] [debug] #1 00493990 in ?? () from samp-server.exe [23:15:03] [debug] #2 0040531e in ?? () from samp-server.exe