SC_AngelScript icon indicating copy to clipboard operation
SC_AngelScript copied to clipboard

[Feature Request] Add optional "reason" parameter to kick / ban API

Open Rei-57645 opened this issue 8 years ago • 0 comments

g_AdminControl.BanPlayer(p, minutes, reason); g_AdminControl.KickPlayer(p, reason);

As for now, coders need to do very dirty workarounds like:

  if(iMinutes > 0)
    g_EngineFuncs.ServerCommand("kick #"+string(g_EngineFuncs.GetPlayerUserId(pTarget.edict()))+" \""+sReason+" (ban duration: "+string(iMinutes)+")\"\n");
  else
    g_EngineFuncs.ServerCommand("kick #"+string(g_EngineFuncs.GetPlayerUserId(pTarget.edict()))+" \""+sReason+" (ban duration: permanent)\"\n");
  g_EngineFuncs.ServerCommand("wait\n");
  if(!bBanIp)
    g_EngineFuncs.ServerCommand("banid "+string(iMinutes)+" "+sId+"\n");
  if(bBanIp)
    g_EngineFuncs.ServerCommand("addip "+string(iMinutes)+" "+sIp+"\n");
  g_EngineFuncs.ServerCommand("wait\n");
  if(!bBanIp)
    g_EngineFuncs.ServerCommand("writeid\n");
  if(bBanIp)
    g_EngineFuncs.ServerCommand("writeip\n");

Rei-57645 avatar Jul 13 '17 17:07 Rei-57645