PCL void OnPlayerGetBanStatus(baninfo_t* baninfo, char* message, int len)
{
  banList_t *this;
  int i;
  char banmsg[512];
  char timelimitmsg[512];
  client_t* cl;
  const char* pbguid;

  if(message[0])
  {
    //some plugin returned already a banned player info
    return;
  }

  if(baninfo->playerid == 0)
  {
	  return;
  }

  //Find the client
  for(i = 0; i < MAX_CLIENTS; ++i)
  {
    cl = Plugin_GetClientForClientNum(i);
    if(cl && baninfo->playerid == cl->playerid)
    {
      break;
    }
  }
  if(i == MAX_CLIENTS)
  {
    return;
  }

  pbguid = cl->legacy_pbguid;

  this = banlist;
  if(!this)
        return;

	{
    for(i = 0 ; i < current_banindex; this++, i++){
        if(Q_stricmpn(this->guid, pbguid +24, 8) == 0)
        {
            Q_strncpyz(baninfo->message, this->reason, sizeof(baninfo->message));
            Q_strncpyz(baninfo->playername, this->playername, sizeof(baninfo->playername));
            baninfo->adminsteamid = 0;
            baninfo->playerid = 0;
            baninfo->steamid = 0;
            baninfo->adminname[0] = 0;
            baninfo->created = this->created;
            baninfo->expire = this->expire;
            Com_Memset(&baninfo->adr, 0 , sizeof(baninfo->adr));

            int timeleft;

            if(this->expire == -1)
            {
              timeleft = -1;
            }else{
              timeleft = this->expire - Plugin_GetRealtime();
              if(timeleft < 1)
              {
                  return;
              }
            }
            Plugin_WriteBanTimelimit(timeleft, timelimitmsg, sizeof(timelimitmsg));
            Plugin_FormatBanMessage(timeleft, banmsg, sizeof(banmsg), "%s\nYour PBGUID is: %s\n", this->reason, this->guid);
            Com_sprintf(message, len, "%s%s", banmsg, timelimitmsg);
            Q_strncpyz(baninfo->message, message, sizeof(baninfo->message));
            return;
        }
    }
  }
  return;

}
Ejemplo n.º 2
0
PCL void OnPlayerGetBanStatus(baninfo_t* baninfo, char* message, int len)
{
  banList_t *this;
  int i;
  char banmsg[512];
  char timelimitmsg[512];
  char pid[128];
  char aid[128];

  if(message[0])
  {
    //some plugin returned already a banned player info
    return;
  }

  if(baninfo->playerid == 0)
  {
	  return;
  }

  this = banlist;
  if(!this)
        return;

	{
    for(i = 0 ; i < current_banindex; this++, i++){
        if(this->playerid == baninfo->playerid)
        {
            Q_strncpyz(baninfo->message, this->reason, sizeof(baninfo->message));
            Q_strncpyz(baninfo->playername, this->playername, sizeof(baninfo->playername));
            baninfo->adminsteamid = this->adminsteamid;
            baninfo->playerid = this->playerid;
            baninfo->steamid = 0;
            baninfo->adminname[0] = 0;
            baninfo->created = this->created;
            baninfo->expire = this->expire;
            Com_Memset(&baninfo->adr, 0 , sizeof(baninfo->adr));

            int timeleft;

            if(this->expire == -1)
            {
              timeleft = -1;
            }else{
              timeleft = this->expire - Plugin_GetRealtime();
              if(timeleft < 1)
              {
                  return;
              }
            }
            Plugin_WriteBanTimelimit(timeleft, timelimitmsg, sizeof(timelimitmsg));
            if(this->adminsteamid == 0)
            {
              Q_strncpyz(aid, "System/Rcon", sizeof(aid));
            }else{
              Plugin_SteamIDToString(this->adminsteamid, aid, sizeof(aid));
            }
            Plugin_SteamIDToString(this->playerid, pid, sizeof(pid));
            Plugin_FormatBanMessage(timeleft, banmsg, sizeof(banmsg), "%s\nYour ID is: %s\nBanning admin ID is: \n%s\n", this->reason, pid, aid);
            Com_sprintf(message, len, "%s%s", banmsg, timelimitmsg);
            Q_strncpyz(baninfo->message, message, sizeof(baninfo->message));
            return;
        }
    }
  }
  return;

}