09.02.2013, 22:07
Hi , I wanted to create /accountban [PLAYERNAME] [REASON] command but don't know how to ,
this is the /cban (to ban connected players ) to check the variables & way i'm working with.
Is there any way to change Banned variable for the 'PlayerName' to 1? like /accountban [Playername] [Reason] (for disconnected players)
this is the /cban (to ban connected players ) to check the variables & way i'm working with.
pawn Code:
dcmd_cban(playerid, params[])
{
if (AdminLevel[playerid] < 3 ) {
SendClientMessage(playerid, COLOR_GREY, "You must be admin to use this command.");
}
else {
if (AdminLevel[playerid] >= 3) {
if(strlen(params) > 40) return SendClientMessage(playerid, COLOR_CERVENA, " Reason too long.");
new pos;
new string[150];
if(!params[0] || !(pos = chrfind(' ', params) + 1) || !params[pos]) return SendClientMessage(playerid, COLOR_GREY, "Usage: /cban [Playerid] [Reason]");
new CMD_ID = strval(params);
if(!IsPlayerConnected(CMD_ID)) return SendClientMessage(playerid, COLOR_CERVENA, "This player is not connected");
if(IsPlayerNPC(CMD_ID)) return SendClientMessage(playerid, COLOR_CERVENA, "You can't ban an NPC!");
new Admintext[128];
if(AdminLevel[playerid] >= 3) { Admintext = "[Administrator]"; }
format(string, sizeof(string), "[SERVER] : %s is account-banned by %s %s [Reason : %s]", PlayerName(CMD_ID),Admintext,PlayerName(playerid),params[pos]);
SendClientMessageToAll(COLOR_ORANGE, string);
format(string, sizeof(string), "[%s] %s has banned %s[Reason:%s]", Admintext,PlayerName(playerid), PlayerName(CMD_ID),params[pos]);
Banned[CMD_ID] = 1;
CodeUnban[CMD_ID] = 1648945654897 + random(900000000000000);
dini_Set(file[CMD_ID], "BanReason", params[pos]);
dini_Set(file[CMD_ID], "BanAdmin", PlayerName(playerid));
Kick(CMD_ID);
}
}
return 1;
}