i might have something for you from my script, you need ZCMD, sscanf and to know and save stats with YSI and (optional)"foreach" from ******:
Code:
CMD:unban(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] > 3) //Change to what level the CMD to be or to "if(IsPlayerAdmin(playerid))"
{
if(PlayerInfo[playerid][pLogged] == 0) return SendClientMessage(playerid,COLOR_WHITE,"*** Login first!"); //Delete this if you don't have a variable Login
new string[90],tname[200];
if(sscanf(params,"s[200]",tname)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /unban [playername]");
new filestring[128],AdminName[MAX_PLAYER_NAME];
GetPlayerName(playerid,AdminName,sizeof(AdminName));
format(filestring, sizeof(filestring), "/Users/%s.ini", tname);
if(!fexist(filestring)) return SendClientMessage(playerid,COLOR_WHITE, "That name doesn't exist");
new INI:File = INI_Open(filestring);
INI_SetTag(File,"data");
INI_WriteInt(File,"Banned",0);
INI_Close(File);
format(string,sizeof(string),"Success! You have banned %s.",tname);
SendClientMessage(playerid,COLOR_LIGHTRED,string);
foreach(new i : Player) // if you don't have foreach change this (see the bottom)
{
if(PlayerInfo[i][pAdmin] > 0) // Again change it if you want/need
{
format(string,sizeof(string),"(AdmChat) %s was unbanned by Admin %s.",tname,AdminName);
SendClientMessage(i,COLOR_LIGHTRED,string);
print(string);
}
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"*** You are not authorized to use that cmd.");
return 1;
}
return 1;
}
if you dont have foreach change those lines to:
Code:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
format(string,sizeof(string),"(AdmChat) Admin %s cuffed %s.",AdminName,Name);
SendClientMessage(i,COLOR_YELLOW,string);
print(string);
}
}
}
For tutorial to save stats and LOGIN/REGISTER with YSI see
https://sampforum.blast.hk/showthread.php?tid=273088
HOPE IT HELPS!