04.03.2014, 11:10
(
Последний раз редактировалось Necro[ABK]; 04.03.2014 в 11:21.
Причина: pawno bbcode failed
)
ok my problem is when I connect to my server on my host, it loses my name after it does my temp ban check my name becomes null. after name is set to null whenever it tries to use it, formated in a string, in sendclientmessage the server crashes. other players can connect fine doesn't do this for them, does this on both of my pcs with any name I use. However when I run the server from localhost(my pc) it does NOT do it and I connect just fine. I can connect to other servers on the same host aswell with no error.
very confusing error hope I explained it well enough. I usually don't need any help, but with this I'm at a loss. Thanks in advance to any suggestions, ideas and/or fixes.
things I've already tried:
reinstalled sa-mp 3z and GTA:SA, still null name after the tempbancheck returns false.
commented the tempbancheck out and it worked fine for me on the host.
here comes the code:
Onplayerconnect
Tempban code
the code failed to paste with proper indentation but I did indent to where the code gets to.
Server Log
very confusing error hope I explained it well enough. I usually don't need any help, but with this I'm at a loss. Thanks in advance to any suggestions, ideas and/or fixes.
things I've already tried:
reinstalled sa-mp 3z and GTA:SA, still null name after the tempbancheck returns false.
commented the tempbancheck out and it worked fine for me on the host.
here comes the code:
Onplayerconnect
Код:
printf("my name is %s", fName(playerid)); if(TempBanCheck(playerid)){ Kick(playerid); return 1; } else{ printf("then my name is %s", fName(playerid)); }
Код:
stock TempBanCheck(playerid) { if(!test){ MySQLCheck(); return false; } new ip[15]; new str[128]; new tmp[256]; new query[512]; new ban_second, ban_minute, ban_hour, ban_day, ban_month, ban_year; GetPlayerIp(playerid, ip, sizeof(ip)); format(query,sizeof(query),"SELECT * FROM `"TEMPBANTABLENAME"` WHERE tempban_ip = '%s'",ip); mysql_query(query,-1,playerid,connection); mysql_store_result(connection); new nrows = mysql_num_rows(connection); if(nrows == 1) { mysql_fetch_field("tempban_second",tmp,connection); ban_second = strval(tmp); mysql_fetch_field("tempban_minute",tmp,connection); ban_minute = strval(tmp); mysql_fetch_field("tempban_hour",tmp,connection); ban_hour = strval(tmp); mysql_fetch_field("tempban_day",tmp,connection); ban_day = strval(tmp); mysql_fetch_field("tempban_month",tmp,connection); ban_month = strval(tmp); mysql_fetch_field("tempban_year",tmp,connection); ban_year = strval(tmp); mysql_free_result(connection); }else{ mysql_free_result(connection); printf("beore return false my name is %s", fName(playerid)); return false; } new year, month, day, hour, minute, second; getdate(year, month, day); gettime(hour, minute, second); new bool:kban=false; if(year >= ban_year && month > ban_month){ kban = false; }else{ if(ban_year > year){ kban = true; } if(ban_month > month && ban_year >= year){ kban = true; } if(ban_day > day && ban_month >= month && ban_year >= year){ kban = true; } if(ban_day == day && ban_month == month && ban_year == year) { if(ban_hour > hour) { kban = true; }else{ if(ban_minute >= minute && ban_second >= second) { kban = true; } } } } if(kban == true) { if(ban_minute<=9 && ban_minute>=0){ if(ban_second<=9 && ban_second>=0){ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); }else{ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); } }else{ if(ban_second<=9 && ban_second>=0){ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); }else{ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); } } SendClientMessage(playerid, RED, str); return true; }else{ format(query,sizeof(query),"DELETE FROM `"TEMPBANTABLENAME"` WHERE `tempban_ip` = '%s'", ip); mysql_query(query,-1,playerid,connection); } return false; }
Server Log
Quote:
[05:03:49] Incoming connection: *.*.*.*:51603 [05:03:50] [join] [ABK]Necro has joined the server (0:*.*.*.*) [05:03:50] my name is [ABK]Necro [05:03:50] beore return false my name is [ABK]Necro [05:03:50] then my name is |