/unban command help.
#1

I would like to know if i can make an /unban [playername] command which will allow admins to unban a player by entering his name and not his IP.
Could someone help me?
Reply
#2

Wrong Section.
Reply
#3

Quote:
Originally Posted by Sojo12
Посмотреть сообщение
Wrong Section.
No its not . Its the correct section .
Reply
#4

Bump
Reply
#5

How can we do that without your codes
+tell what u use as database ini / mysql
Reply
#6

Quote:

if (strcmp(cmd, "/unban", true)==0)
{
if((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >=4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [PlayerName_LastName]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(giveplayer));
format(string, 256, "AdmWarning: %s has unbanned account %s", sendername, tmp);
ABroadCast(COLOR_YELLOW,string,1);
format(string, 256, "AdmWarning: %s has unbanned account %s", sendername, tmp);
printf(string);
format(string,sizeof(string),"users/%s.ini",tmp);
dini_IntSet(string, "Banned", 0);
dini_IntSet(string, "Warnings", 0);
SendClientMessage(playerid, COLOR_WHITE, "Player Unbanned");
SendRconCommand(string);
SendRconCommand("reloadbans");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
}
return 1;

Check if that works.

If it does not work, Try this:
Quote:

COMMAND:unban(playerid, params[])
{
new str[128], account[30], file[128];
if(PlayerStat[playerid][AdminLevel] < 4) return SendClientMessage(playerid, GREY, "You can't use this command.");
if(sscanf(params,"s[30]", account))return SendClientMessage(playerid, GREY, "USAGE: /unban [playeraccount]");
format(file, sizeof(file), "Accounts/%s.ini", account);
if(fexist(file))
{
if(INI_Open(file))
{
if(INI_ReadInt("Banned") == 1)
{
INI_WriteInt("Banned", 0);
format(str, sizeof(str), "You have successfully unbanned account '%s'.", account);
SendClientMessage(playerid, RED, str);
format(str, sizeof(str), "Admin %s has deleted unbanned '%s'.", GetOOCName(playerid), account);
AdminActionLog(str);
format(str, sizeof(str), "%s Unbanned.", account);
BanLog(str);

INI_Save();
INI_Close();
}
else return SendClientMessage(playerid, GREY, "This account isn't banned.");
}
}
else return SendClientMessage(playerid, GREY, "This account does not exist.");
return 1;
}

Reply
#7

you need to add your script , we dont know what variable you use to check if the player admin or not like give us more details
Reply
#8

I figured it out , delete this!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)