#1

Another problem, Sorry for these noob questions - My head is fucked up

I need /unban command for below /ban command

pawn Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 2)
    {
        if(IsPlayerConnected(playerid))
        {
            new targetid,reason[105],string[256];
            if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

            format(string, sizeof(string), ""chat""COL_RED" %s %s has banned %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
            SendClientMessageToAll(-1,string);

            BanPlayer(targetid,reason,PlayerName(playerid));
        }
    }
    else {
        SendClientMessage(playerid,-1,""chat""COL_RED" You do not have the right admin permissions for this command!");
    }
    return 1;
}
Reply
#2

we need to see your BanPlayer Function so we can reverse it.
Reply
#3

Quote:
Originally Posted by mahdi499
Посмотреть сообщение
we need to see your BanPlayer Function so we can reverse it.
Hm? I don't got it
Can you say it abit clear?
Reply
#4

Quote:
Originally Posted by lakshikagayal
Посмотреть сообщение
Hm? I don't got it
Can you say it abit clear?
Search on your gamemode/fs about "BanPlayer"
Then past it here.
Reply
#5

Quote:
Originally Posted by DeMoX
Посмотреть сообщение
Search on your gamemode/fs about "BanPlayer"
Then past it here.
Here's some

pawn Код:
if(killerid != INVALID_PLAYER_ID)
    {
        if(!PlayerShotPlayer[killerid][playerid])
        {
            new Admin[24] = "Anti-cheat";
            new reason3[128] = "Fake Killing";
            BanPlayer(playerid,reason3,Admin);
        }
    }
pawn Код:
if(team[killerid] == TEAM_HUMAN)
    {
        if(GetPlayerSkin(killerid) == 0)
        {
            new Admin[24] = "Anti-cheat";
            new reason3[128] = "Skin Hack (SI 0)";
            BanPlayer(killerid,reason3,Admin);
        }
    }
Reply
#6

Quote:
Originally Posted by lakshikagayal
Посмотреть сообщение
Here's some

pawn Код:
if(killerid != INVALID_PLAYER_ID)
    {
        if(!PlayerShotPlayer[killerid][playerid])
        {
            new Admin[24] = "Anti-cheat";
            new reason3[128] = "Fake Killing";
            BanPlayer(playerid,reason3,Admin);
        }
    }
pawn Код:
if(team[killerid] == TEAM_HUMAN)
    {
        if(GetPlayerSkin(killerid) == 0)
        {
            new Admin[24] = "Anti-cheat";
            new reason3[128] = "Skin Hack (SI 0)";
            BanPlayer(killerid,reason3,Admin);
        }
    }
Search for "stock BanPlayer" or "public BanPlayer" and post that function here!
Reply
#7

Anyone?
Reply
#8

Use this stock to unban a player using their IP;

pawn Код:
stock UnbanPlayer(ip[])
{
   new string[32];
   format(string, sizeof(string), "unban %s", ip);

   SendRconCommand(string);
   return 1;
}
Reply
#9

pawn Код:
stock UnbanPlayer(ip[])
{
   new string[32];
   format(string, sizeof(string), "unbanip %s", ip);

   SendRconCommand(string);
   SendRconCommand("reloadbans");
   return 1;
}
Reply
#10

Alright here you go:

-Put this in the top of your script:

pawn Код:
#define COLOR_DARKRED 0xAA3333FF
Where the commands are:
pawn Код:
CMD:unban(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); // Logging in, maybe you have it as [!IsPlayerConnected]
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); // Change it to whatever you want.
    new string[128];
    if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /unban [name]");
    new file[64], IP[16];
    format(file, sizeof(file), "users/%s.ini", params); // Change it to the directory of the accounts.
    if(dini_Exists(file))
    {
        if(dini_Int(file, "pBanned") == 0) return SendClientMessage(playerid, COLOR_GREY, "Player is not banned.");
        format(IP, sizeof(IP), "%s", dini_Get(file, "IP"));
        // Userfile
        dini_IntSet(file, "pBanned", 0);
        dini_IntSet(file, "Warns", 0);
        dini_Set(file, "Warn1", "");
        dini_Set(file, "Warn2", "");
        dini_Set(file, "Warn3", "");
        dini_Set(file, "BanReason", ""); // You've the rights to remove those if you don't have the system like that, Just comment them.
        dini_Set(file, "BannedBy", "");
        UnbanPlayer(ip[]); // The stock that was given.
        format(string, sizeof(string), "AdmWarn: %s has unbanned %s.", RPN(playerid), params);
        SendAdminMessage(COLOR_DARKRED, 1, string);
        format(string, sizeof(string), "AdmWarn: %s (%s) has unbanned %s (%s).", RPN(playerid), RPIP(playerid), params, IP);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)