01.08.2014, 17:58
(
Последний раз редактировалось GeekSiMo; 02.08.2014 в 11:51.
)
[SOLVED]
if (strcmp(cmd, "/unban", true)==0)
{
if(PlayerInfo[playerid][pAdmin] >=1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [PlayerName]");
return 1;
}
format(string, sizeof(string), "users/%s.ini", tmp);
new File:hFile = fopen(string, io_read);
//new File: hFile = fopen(string, io_append);
if (hFile)
{
new Data[ 256 ],val [ 256 ];
while ( fread( hFile , Data , sizeof( Data ) ) )
if( strcmp( ini_GetKey( Data ) , "Locked" , true ) == 0 )
val = ini_GetValue( Data );
if(strval( val ) == 1)
{
new var[64];
format(var, sizeof(var), "Locked=1\n");
//fdeleteline(string,var);
fclose(hFile);
hFile = fopen(string, io_append);
format(var, 64, "Locked=0\n");
fwrite(hFile, var);
fclose(hFile);
}
else
{
fclose(hFile);
return SendClientMessage(playerid, COLOR_WHITE, " ERROR : Player account doesn`t locked!!");
}
}
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_WHITE, "Player unlocked please ask for his IP and use /unbanip [IP]");
format(string, 128, "AdmWarning: %s has unbanned %s", sendername, tmp);
ABroadCast(COLOR_LIGHTRED,string,1);
new year, month,day;
getdate(year, month, day);
format(string, 128, "AdmWarning: %s has unbanned %s (%d-%d-%d)", sendername, tmp,day,month,year);
BanLog(string);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
return 1;
}
CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 3)
{
new File[50], string[128];
if(sscanf(params, "u[50]",File)) return SendClientMessage(playerid, COLOR_YELLOW, "-XSBot-: Correct Usage: /unban [Player Name]");
format(File, sizeof(File), "Users/%s.ini", params);
if(!fexist(File)) return SendClientMessage(playerid, COLOR_RED, "-XSBot-: This player is not registered.");
if(INT_Int(File, "Banned") == 0) return SendClientMessage(playerid, COLOR_RED, "-XSBot-: This player is not marked as banned, unable to proceed with unbanning.");
INT_IntSet(File, "Banned", 0);
format(string, sizeof(string), "%s has been unbanned by %s", File, GetName(playerid));
SaveIn("UnbanLog",string);
format(string, sizeof(string), "-XSBot-: {FF0000}%s {FFFF00}has been unbanned by %s{FFFF00}.", params, GetColorNameID(playerid));
SendClientMessageToAll(COLOR_YELLOW, string);
}
else return SendErrorMessage(playerid, ADMIN_ERROR);
return 1;
}
CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 3)
{
new File[50], string[128];
if(sscanf(params, "u[50]",File)) return SendClientMessage(playerid, COLOR_YELLOW, "-XSBot-: Correct Usage: /unban [Player Name]");
format(File, sizeof(File), "Users/%s.ini", params);
if(!fexist(File)) return SendClientMessage(playerid, COLOR_RED, "-XSBot-: This player is not registered.");
new Bnd;
new INI:File = INI_Open(File);
Bnd = INI_Int("Banned", Bnd);
if(Bnd == 0) return SendClientMessage(playerid, COLOR_RED, "-XSBot-: This player is not marked as banned, unable to proceed with unbanning.");
INI_WriteInt(File, "Banned", 0);
INI_Close(File);
format(string, sizeof(string), "%s has been unbanned by %s", File, GetName(playerid));
SaveIn("UnbanLog",string);
format(string, sizeof(string), "-XSBot-: {FF0000}%s {FFFF00}has been unbanned by %s{FFFF00}.", params, GetColorNameID(playerid));
SendClientMessageToAll(COLOR_YELLOW, string);
}
else return SendErrorMessage(playerid, ADMIN_ERROR);
return 1;
}
CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 3)
{
new path[36], string[128];
if (isnull(params)) return SendClientMessage(playerid, COLOR_YELLOW, "-XSBot-: Correct Usage: /unban [Player Name]");
format(path, sizeof(path), "Users/%s.ini", params);
if(!fexist(path)) return SendClientMessage(playerid, COLOR_RED, "-XSBot-: This player is not registered.");
new file = INI_Open(path);
// If you have a tag, write it here or it will not work.
INI_WriteInt(file, "Banned", 0);
INI_Close(file);
format(string, sizeof(string), "%s has been unbanned by %s", File, GetName(playerid));
SaveIn("UnbanLog",string);
format(string, sizeof(string), "-XSBot-: {FF0000}%s {FFFF00}has been unbanned by %s{FFFF00}.", params, GetColorNameID(playerid));
SendClientMessageToAll(COLOR_YELLOW, string);
}
else return SendErrorMessage(playerid, ADMIN_ERROR);
return 1;
}