13.03.2014, 16:11
pawn Код:
dcmd_accban(playerid,params[])
{
new string[128];
new ID;
new time;
new reason;
if(sscanf(params,"uis[100]",ID,time,reason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /accban (Player Name/ID) (Days) (Reason)");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"[ERROR] The player ID (%d) is not connected to the server. You cannot ban them.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
new string1[128];
format(string1,sizeof(string1),"[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s. Time : %i days.",PlayerName(ID),ID,reason,time);
SendClientMessageToAll(COLOR_ADMIN,string1);
jBan(ID,playerid,reason,time);
LogTo("AccountBans",string1);
format(string,sizeof(string),"9[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s. Ban Time : %i days.",PlayerName(ID),ID,reason,time);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
return 1;
}
Stock is given below.
pawn Код:
stock jBan(player_banned, player_banner, reason[], time = 0)
{
new TempQuery[500];
new IP[14];
GetPlayerIp(player_banned,IP,sizeof(IP));
format(TempQuery, sizeof(TempQuery), "INSERT INTO `"Bans_Table"` (user_banned, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', '%s', '%s', CURRENT_TIMESTAMP, %d)", PlayerName(player_banned), IP, PlayerName(player_banner), reason, time);
mysql_query(TempQuery);
jBanCheck(player_banned);
Kick(player_banned);
return 1;
}
Thanks.