please help with /unban
#1

Hi all!
I am a newbie and wants someone to help me with /unban command.
Whenever I post help it goes useless but this time please someone help me with it.
Quote:

dcmd_ban(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"ban")) {
if(!strlen(params)) return SendClientMessage(playerid,red,"Syntax Error: \"/BAN <NICK OR ID> (<REASON>)\".");
new tmp[256],Index; tmp = strtok(params,Index);
new id; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
SendCommandMessageToAdmins(playerid,"BAN");
new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
if(!strlen(params[strlen(tmp)+1])) format(string,256,"\"%s\" has been Banned by Administrator \"%s\".",ActionName,name);
else format(string,256,"\"%s\" has been Banned by Administrator \"%s\". (Reason: %s)",ActionName,name,params[strlen(tmp)+1]);
SendClientMessageToAll(yellow,string); return Ban(id);
} else return SendClientMessage(playerid,red,"ERROR: You can not ban yourself or a disconnected player.");
} else return SendLevelErrorMessage(playerid,"ban");
}

This is my ban command help me with /unban please!!!!!!!!!!!!!!!!!!!!!!!!!!!
Reply
#2

Well I have made this for my own server but it unbans the players ip
Код:
dcmd_unban(playerid,params[]){
{
    new ip[32], dformat[64];
    if(APlayerData[playerid][PlayerLevel] < 3) return SendClientMessage(playerid,0xff0000ff,"You have to be admin LVL 3 at least");
    if(sscanf(params,"s[32]",ip)) return SendClientMessage(playerid,0xff0000ff,"USAGE: /unbanip [ip]");
    format(dformat,sizeof dformat,"unbanip %s",ip);
    SendRconCommand(dformat);
    return 1;
}
The code is ZCMD i've made it DCMD not sure if it works but give it a try
Reply
#3

EDIT: Sorry misunderstanding! thanks at all!!
Reply
#4

Not Working! Tried too much!! Anyone?
Reply
#5

try this :
Quote:

dcmd_unban(playerid,params[])
{
if(AccInfo[playerid][LoggedIn] == 1)
{
if(AccInfo[playerid][Level] >= 4)
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);

if(!strlen(params)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /unban [PlayerID] [Reason]") &&
SendClientMessage(playerid, orange, "Function: Will unBan the specified player");
new player1;
new string[128];
new playername[MAX_PLAYER_NAME];
new adminname [MAX_PLAYER_NAME];
player1 = strval(tmp);

if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (AccInfo[player1][Level] != ServerInfo[MaxAdminLevel]))
{
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));;
SendCommandToAdmins(playerid,"Administrator %s Used /unban");
format(string,sizeof(string),"|- %s has been UNBanned by Administrator %s ",playername,adminname,params[2]);
SendClientMessageToAll(lightred,string);
new str[128];
format(str,sizeof(str),"%s has been unBanned by Administrator %s",playername,adminname,params[2]);
SaveIn("BanLog",str);
print(string);
if(udb_Exists(PlayerName2(player1)) && AccInfo[player1][LoggedIn] == 1)
dUserSetINT(PlayerName2(player1)).("Banned",0);
}
else return SendClientMessage(playerid, red, "ERRPR: Player is not connected or is yourself or is the highest level admin");
}
else return ErrorMessages(playerid, 1);
}
else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

Reply
#6

got these
Quote:

D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1229) : error 036: empty statement
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1234) : error 017: undefined symbol "SaveIn"
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1236) : error 017: undefined symbol "udb_Exists"
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1236) : warning 215: expression has no effect
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1236) : error 001: expected token: ";", but found "]"
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1236) : error 029: invalid expression, assumed zero
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1236) : fatal error 107: too many error messages on one line

Reply
#7

Just a simple DCMD command will be fine.
Reply
#8

Anyone?
Reply
#9

Here you go
Quote:

dCMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBanAppealer] >= 1)
{
new string[128];
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

if(doesAccountExist(params))
{
OnPlayerOfflineLogin(params);
if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 )
{
SendClientMessageEx( playerid, COLOR_WHITE, "Permanently banned accounts can only be unbanned via FTP." );
}
else
{
if( PlayerInfo[MAX_PLAYERS][pBanned] >= 1 )
{
PlayerInfo[MAX_PLAYERS][pBanned] = 0;
PlayerInfo[MAX_PLAYERS][pWarns] = 0;
PlayerInfo[MAX_PLAYERS][pDisabled] = 0;
RemoveBan(PlayerInfo[MAX_PLAYERS][pIP]);
print("OnPlayerOfflineLogin: Saving variables to file");
OnPlayerOfflineSave(params);
print("OnPlayerOfflineLogin: Variables saved properly");
format(string, 128, "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was unbanned by %s. (%d-%d-%d)", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid),month,day,year);
Log("logs/ban.log", string);
print(string);
}
else
{
SendClientMessageEx( playerid, COLOR_WHITE, "Not a banned account!" );
}
}
}
else
{
SendClientMessageEx( playerid, COLOR_WHITE, "That account doesn't exist." );
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}

Reply
#10

I got these
Quote:

D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1213) : error 017: undefined symbol "PlayerInfo"
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1213) : warning 215: expression has no effect
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1213) : error 001: expected token: ";", but found "]"
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1213) : error 029: invalid expression, assumed zero
D:\Sa-mp server\filterscripts\XtremeAdmin2.pwn(1213) : fatal error 107: too many error messages on one line

I am using Xtremeadmin2 help please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)