Ban System Help! [REP+]
#1

Hello my ban system is bugged when I am trying to ban a player the player is banning succesfuly but when I try to unban him I got to response

Ban Command:

pawn Код:
CMD:ban(playerid,params[]) {
    if(PlayerInfo[playerid][LoggedIn] == 1) {
        if(PlayerInfo[playerid][Level] >= 2) {
            new tmp[256], tmp2[256], Index;     tmp = strtok(params,Index), tmp2 = strtok(params,Index);
            if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE:{FFFFFF} /Ban [playerid] [reason]");
            if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE:{FFFFFF} /Ban [playerid] [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),"*** Player %s has been banned by Administrator %s.",playername,adminname);
                SendClientMessageToAll(red,string);
                format(string,sizeof(string),"[Reason: %s]",params[2]);
                SendClientMessageToAll(red,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,params[2]);
            } else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
        } else return SendClientMessage(playerid,red,"ERROR:{FF9E00} You are not a high enough level to use this command");
    } else return SendClientMessage(playerid,red,"ERROR:{FF9E00} You must be logged in to use this commands");
}
Unban Command:

pawn Код:
CMD:unban(playerid, params[])
{
   if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
   {
      new target[50];
      if(sscanf(params,"s[50]", target)) return SendClientMessage(playerid, red,"[USAGE]: /unban [player name]");
      CMDMessageToAdmins(playerid,"UNBAN");
    } else return SendClientMessage(playerid, RED,"ERROR: You need to be level 2 to use this command!");
    return 1;
}
REP+ to everybody who will help me
Reply
#2

Your unban command does nothing,you need to make one..
Reply
#3

PHP код:
CMD:unban(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        new 
string[128];
        if(
isnull(params)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /unban [playername]");

        if( 
PlayerInfo[playerid][pBan] >= )
        {
            
PlayerInfo[playerid][pBan] = 0;
            print(
"OnPlayerOfflineLogin: Variables saved properly");
            
format(string128"[ADMIN] %s (IP:%s) was unbanned by %s."paramsPlayerInfo[playerid][pIP], GetPlayerNameEx(playerid));
            
SendStaffMessage(COLOR_RED,string);
            new 
yearmonth,day;
            
getdate(yearmonthday);
            new 
playa[MAX_PLAYER_NAME];
            
GetPlayerName(playeridplayaMAX_PLAYER_NAME);
            
format(stringsizeof(string), "[ADMIN] %s : was unbanned by %s."paramsplaya);
            
SendStaffMessage(COLOR_REDstring);
        }
        else
        {
            
SendClientMessageplayeridCOLOR_WHITE"Not a banned account or no such account was found!" );
        }
    }
    return 
1;

This is good
Combinate it with your script and i promis you will work
Reply
#4

PHP код:
CMD:unbanip(playeridparams[])
{
        if(
PlayerInfo[playerid][Level] >= 2) {
        new
            
ip[48],string[64],String[27];
        if(
sscanf(params"s[48]",ip)) return SendClientMessage(playeridred"USAGE: /unbanip [ip]");
        
format(string,sizeof(string),"unbanip %s",ip);
        
SendRconCommand(string);
        
SendRconCommand("reloadbans");
        
format(Stringsizeof(String),"You Have Unbanned IP: %s"ip);
        
SendClientMessage(playerid, -1String);
        return 
1;
        } else return 
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");

Try this hope this one work
Reply
#5

Quote:
Originally Posted by arlindi
Посмотреть сообщение
This is good
Combinate it with your script and i promis you will work
Your code doesn't match with his at all, you just took it out of your script.

On topic:
You didn't do anything in your unban command to unban the player.
Reply
#6

Yea I know but I can't make one I tried it but I failed can anyone script a unban command with my fuctions,ranks etc.?
Reply
#7

There's a topic for that.
Quote:
Originally Posted by Forum Rules
Script Requests - If you are requesting a script be made for you, rather than help with your coding, post in the Looking for scripters/helpers? Post here! Thread.
Reply
#8

It will late or I will got no response pfff

Anyway thanks for helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)