CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=1)
{
new string[200];
new banner[24];
if(isnull(params)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /ban [playername]");
format(string,sizeof(string), "INFO: You have banned %s's account.", GetName(banner));
SendClientMessage(playerid, COLOR_INFO, string);
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Banned",1);
INI_Close(File);
Ban(playerid);
return 1;
}
else return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are unauthorized to use this command.");
}
CMD:ban(playerid, params[])
{
if (PlayerEnum[playerid][pAdminLevel] < 1)
{
SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are unauthorized to use this command.");
return 1;
}
new targetid, reason[128], string[145];
if (sscanf(params, "us[128]", targetid, reason))
{
SendClientMessage(playerid, COLOR_USAGE, "USAGE: /ban [playerid] [reason]");
return 1;
}
format(string, sizeof(string), "INFO: You have banned %s's account.", GetName(targetid));
SendClientMessage(playerid, COLOR_INFO, string);
format(string, sizeof(string), "** Admin %s banned %s. [Reason: %s]", GetName(playerid), GetName(targetid), reason);
SendClientMessageToAll(COLOR_INFO, string);
new INI:file = INI_Open(UserPath(targetid));
INI_WriteInt(file, "Banned", 1);
INI_Close(file);
return Ban(targetid);
}
Whenever I type /ban 0 Test to test the command it just returns the SCM.
|
CMD:ban(playerid, params[])
{
if (PlayerEnum[playerid][pAdminLevel] < 1)
{
SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are unauthorized to use this command.");
return 1;
}
new targetid, reason[128], string[145];
if (sscanf(params, "us", targetid, reason))
{
SendClientMessage(playerid, COLOR_USAGE, "USAGE: /ban [playerid] [reason]");
return 1;
}
format(string, sizeof(string), "INFO: You have banned %s's account.", GetName(targetid));
SendClientMessage(playerid, COLOR_INFO, string);
format(string, sizeof(string), "** Admin %s banned %s. [Reason: %s]", GetName(playerid), GetName(targetid), reason);
SendClientMessageToAll(COLOR_INFO, string);
new INI:file = INI_Open(UserPath(targetid));
INI_WriteInt(file, "Banned", 1);
INI_Close(file);
return Ban(targetid);
}