baso88 / SC_AngelScript

Sven Co-op AngelScript documentation, tutorials, sample code and tools
41 stars 4 forks source link

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

Open Martin-H2 opened 7 years ago

Martin-H2 commented 7 years ago

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");