Ban cmd help
#1

Hello, i need a help with ban commands
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");}
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.
Reply
#2

please help guys..
Reply
#3

u mean u want to mix them ?
Reply
#4

Quote:
Originally Posted by Avi57
Посмотреть сообщение
u mean u want to mix them ?
Yes i want to mix them but it should work, i have tried alot but not worked. :S
Reply
#5

You can use /rcon ban! But try this : link 1 link 2
Reply
#6

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
You can use /rcon ban! But try this : link 1 link 2
Read what i wrote above carefully!
Reply
#7

Quote:
Originally Posted by Crazyboobs
Посмотреть сообщение
Read what i wrote above carefully!
Oh...
Reply
#8

pawn Код:
CMD:ban(playerid,params[])
{
    if(PlayerInfo[playerid][LoggedIn] == 1) {
        if(PlayerInfo[playerid][Level] >= 5) {
            new ban_target, ban_time, ban_reason[40], playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, adminname, sizeof(adminname));
            if(sscanf(params,"uis[40]", ban_target, ban_time, ban_reason)) return SendMessageToPlayer(playerid,COLOR_RED, "USAGE: /ban [playerid] [time] [reason]");
            if(ban_time < 0) return SendClientMessage(playerid, COLOR_RED, "[SAMP-BANS]: Please input a valid ban time!");
            new string[200], post_string[200];
            if(IsPlayerConnected(ban_target) && ban_target != INVALID_PLAYER_ID && ban_target != playerid && (PlayerInfo[ban_target][Level] != ServerInfo[MaxAdminLevel]) ) {
                GetPlayerName(ban_target, playername, sizeof(playername);
                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] [Duration: %d] [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,ban_reason,ban_time,day,month,year,hour,minuite);
                SendMessageToAll(COLOR_BRIGHTRED,string);
                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",playername, ban_reason, adminname, ips[ban_target], ban_time);
                HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnBanResponse");
                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, ban_reason );
                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");
}
Untested.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)