20.09.2018, 15:10
PHP код:
stock offlineban(player_name, player_banner, reason[], time = 0, system = 0)
{
if(system == 0)
{
if(strlen(reason) > MAX_REASON_LENGTH) return SendClientMessage(player_banner, 0xFFFFFF, ""chat" Sorry, the maximum reason length is "#MAX_REASON_LENGTH" characters!");
if(gotBanned[player_name] == 0)
{
gotBanned[player_name] = 1;
format(jQuery, MAX_QUERY_LENGTH, "INSERT INTO `"#J_TABLE"` (player_name, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', 'System', '%s', CURRENT_TIMESTAMP, %d)", jNames[player_banned], jIP[player_banned], reason, time);
mysql_tquery(handle, jQuery, "", "");
gotBanned[player_name] = 1;
printf(jQuery);
}
}
else
{
if(strlen(reason) > MAX_REASON_LENGTH) return SendClientMessage(player_banner, 0xFFFFFF, ""chat" Sorry, the maximum reason length is "#MAX_REASON_LENGTH" characters!");
if(gotBanned[player_name] == 0)
{
gotBanned[player_name] = 1;
format(jQuery, MAX_QUERY_LENGTH, "INSERT INTO `"#J_TABLE"` (player_name, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', '%s', '%s', CURRENT_TIMESTAMP, %d)", jNames[player_banned], jIP[player_banned], jNames[player_banner], reason, time);
mysql_tquery(handle, jQuery, "", "");
printf(jQuery);
KickEx(player_banned);
}
}
return 1;
}
PHP код:
CMD:offlinetban(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] >= 2)
{
new ban_target2[24], string[128];
if(sscanf(params, "s[24]", ban_target, ban_time, ban_reason)) return SendClientMessage(playerid, -1,""COL_RED"AdmCmds: /offlineban [Nickname] [Days] [Reason]");
format(string, sizeof(string),"*COL_RED*""%s %s has banned %s for %i days [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),ban_target, ban_time, ban_reason);
SendClientMessageToAll(-1, string);
offlineban(ban_target2, playerid, ban_reason, ban_time, 1);
}
else {
SendClientMessage(playerid,-1,""COL_RED"EROARE: U aint admin!");
}
return 1;
}
CMD:offlineban(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] >= 2)
{
new ban_target3[24], string[128];
if(sscanf(params, "s[24]", ban_target3)) return SendClientMessage(playerid, -1,""COL_RED"AdmCmds: /offlineban [Nickname]");
format(string, sizeof(string), ""COL_RED"AdmCmds: %s %s has permanent banned %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),ban_target3, ban_reason);
SendClientMessageToAll(-1, string);
offlineban(ban_target3, playerid, ban_reason, 0, 1);
}
else {
SendClientMessage(playerid,-1,""COL_RED"EROARE: U aint admin");
}
return 1;
}
ex. in mysql username: Zeus. IP: 160.0.0.0
In Game command: /offlinetban Zeus 5(days) Reason
but how can script detects zeus's IP if he's not online?