07.07.2012, 10:52
Hello, i need a help with ban commands
here are the 2 ban cmds
1st ban cmd is from http://www.samp-bans.com/
2nd ban cmd is from ladmin.
I want to put all the functions of ladmin ban cmd to the other ban cmd.
Please anyone help me.
here are the 2 ban cmds
pawn Код:
CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][Level] >= 5) { return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX,"ERROR..." , "You are not a high enough level to use this command\n If you are not an Admin, donate 10$ and get VIP level.", "Ok", "");}
if(sscanf(params, "uis", ban_target, ban_time, ban_reason)) return SendClientMessage(playerid, COLOR_RED, "[SAMP-BAN]: Correct usage -> /ban <player> <time (minutes)> <reason>");
if(!IsPlayerConnected(ban_target)) return SendClientMessage(playerid, COLOR_RED, "[SAMP-BANS]: Player was not found!");
if(ban_time < 0) SendClientMessage(playerid, COLOR_RED, "[SAMP-BANS]: Please input a valid ban time!");
format(post_string, sizeof(post_string), "action=addban&apikey="#APIKEY"&ban_user=%s&ban_reason=%s&ban_admin=%s&ban_ip=%s&ban_time=%d",names[ban_target], ban_reason, names[playerid], ips[ban_target], ban_time);
HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnBanResponse");
Kick(ban_target);
return 1;
}
CMD:ban(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if(PlayerInfo[playerid][Level] >= 5) {
new playname[MAX_PLAYER_NAME];
GetPlayerName(playerid, playname, sizeof(playname));
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(params)) return SendMessageToPlayer(playerid,COLOR_RED, "USAGE: /ban [playerid] [reason]");
if(isnull(tmp2)) return SendMessageToPlayer(playerid,COLOR_RED, "ERROR: You must give a reason");
new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
CMDMessageToAdmins(playerid,"BAN");
format(string,sizeof(string),"%s has been banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,params[2],day,month,year,hour,minuite);
SendMessageToAll(COLOR_BRIGHTRED,string);
SaveToFile("BanLog",string);
print(string);
if(udb_Exists(PlayerName2(player1)) && PlayerInfo[player1][LoggedIn] == 1) dUserSetINT(PlayerName2(player1)).("banned",1);
format(string,sizeof(string),"banned by Administrator %s. Reason: %s", adminname, params[2] );
return BanEx(player1, string);
} else return SendMessageToPlayer(playerid,COLOR_RED, "Player is not connected or is yourself or is the highest level admin");
} else return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX,"ERROR..." , "You are not a high enough level to use this command", "Ok", "");
} else return SendMessageToPlayer(playerid,COLOR_RED,"ERROR: You must be logged in to use this commands");}
2nd ban cmd is from ladmin.
I want to put all the functions of ladmin ban cmd to the other ban cmd.
Please anyone help me.