25.01.2013, 23:53
Hello.
I am logging kills to db. after running format() Query looks like this:
Now the unexplained phenomena: If I remove DebugMsg(playerid,0xFFFFFFFF,Query); this server crashes instantly after executing mysql_query(Query,-1,-1,hForum);. But when I have that DebugMsg there It wont crash. And all It does is that it sends message to client when client is admin. Now what is really interesting is that in windows version I don't have that problem.
Here's my DebugMsg
Could anyone explain why calling this simple function helps me to avoid crash? Why it doesn't crash in windows version?
Ant just 1 more funny fact: If I remove myself from admins calling DebugMsg before mysql_query doesn't save server from crashing.
I am logging kills to db. after running format() Query looks like this:
Код:
NSERT INTO phpbb_score VALUES (NULL, '1', '2', '1', CURRENT_TIMESTAMP, '255', '1.2.3.4', '4.3.2.1')
pawn Код:
public QueryKill(playerid,killerid,reason){
new Query[200],player_ip[16],killer_ip[16];
format(player_ip,sizeof(player_ip),"%s",PlayerInfo[playerid][plIP]);
killer_ip = "None";
new tmpkillerid = INVALID_PLAYER_ID;
if(INVALID_PLAYER_ID != killerid){
format(killer_ip,sizeof(killer_ip),"%s",PlayerInfo[killerid][plIP]);
tmpkillerid = PlayerInfo[killerid][plID];
}
format(Query,sizeof(Query),"INSERT INTO phpbb_score VALUES (NULL, '%d', '%d', '%d', CURRENT_TIMESTAMP, '%d', '%s', '%s')",PlayerInfo[playerid][plID],tmpkillerid,KILL_SCORE,reason,player_ip, killer_ip);
DebugMsg(playerid,0xFFFFFFFF,Query);
mysql_query(Query,-1,-1,hForum);
mysql_free_result(hForum);
}
Код:
public DebugMsg(playerid,color,msg[]) { if (playerid == -1){ if (DevMode){ SendClientMessageToAll(color,msg); } }else{ if(PlayerInfo[playerid][plAdmin] || DevMode){ SendClientMessage(playerid,color,msg); } } }
Ant just 1 more funny fact: If I remove myself from admins calling DebugMsg before mysql_query doesn't save server from crashing.