SA-MP Forums Archive
/unban command help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /unban command help. (/showthread.php?tid=511944)



/unban command help. - Johnson_Brooks - 08.05.2014

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?


Re: /unban command help. - Sojo12 - 08.05.2014

Wrong Section.


Re: /unban command help. - Johnson_Brooks - 08.05.2014

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


Re: /unban command help. - Johnson_Brooks - 14.06.2014

Bump


Re: /unban command help. - BroZeus - 14.06.2014

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


Re: /unban command help. - SaintMikey - 14.06.2014

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;
}




Re: /unban command help. - [Cali]ChrOnic_T - 14.06.2014

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


Re: /unban command help. - Johnson_Brooks - 14.06.2014

I figured it out , delete this!