当前位置: 首页>>代码示例>>C++>>正文


C++ ConVar::SetInt方法代码示例

本文整理汇总了C++中ConVar::SetInt方法的典型用法代码示例。如果您正苦于以下问题:C++ ConVar::SetInt方法的具体用法?C++ ConVar::SetInt怎么用?C++ ConVar::SetInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConVar的用法示例。


在下文中一共展示了ConVar::SetInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MaintainBotQuota

void BotControl::MaintainBotQuota (void)
{
   // this function keeps number of bots up to date, and don't allow to maintain bot creation
   // while creation process in process.

   if (!m_creationTab.IsEmpty () && m_maintainTime < engine->GetTime ())
   {
      CreateItem last = m_creationTab.Pop ();
      int resultOfCall = CreateBot (last.name, last.skill, last.personality, last.team, last.member);

      // check the result of creation
      if (resultOfCall == 0)
      {
         m_creationTab.RemoveAll (); // something wrong with waypoints, reset tab of creation
         yb_quota.SetInt (0); // reset quota
      }
      else if (resultOfCall == 2)
      {
         m_creationTab.RemoveAll (); // maximum players reached, so set quota to maximum players
         yb_quota.SetInt (GetBotsNum ());
      }
      m_maintainTime = engine->GetTime () + 0.2f;
   }

   // now keep bot number up to date
   if (m_maintainTime < engine->GetTime ())
   {
      int botNumber = GetBotsNum ();
      int humanNumber = GetHumansNum ();

      if (botNumber > yb_quota.GetInt ())
         RemoveRandom ();

      if (yb_autovacate.GetBool ())
      {
         if (botNumber < yb_quota.GetInt () && botNumber < engine->GetMaxClients () - 1)
            AddRandom ();

         if (humanNumber >= engine->GetMaxClients ())
            RemoveRandom ();
      }
      else
      {
         if (botNumber < yb_quota.GetInt () && botNumber < engine->GetMaxClients ())
            AddRandom ();
      }

      int botQuota = yb_autovacate.GetBool () ? (engine->GetMaxClients () - 1 - (humanNumber + 1)) : engine->GetMaxClients ();

      // check valid range of quota
      if (yb_quota.GetInt () > botQuota)
         yb_quota.SetInt (botQuota);

      else if (yb_quota.GetInt () < 0)
         yb_quota.SetInt (0);

      m_maintainTime = engine->GetTime () + 0.25f;
   }
}
开发者ID:xurubin,项目名称:yapb,代码行数:59,代码来源:control.cpp

示例2: RemoveAll

void BotControl::RemoveAll (void)
{
   // this function drops all bot clients from server (this function removes only yapb's)`q

   CenterPrint ("Bots are removed from server.");

   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (m_bots[i] != null)  // is this slot used?
         m_bots[i]->Kick ();
   }
   m_creationTab.RemoveAll ();

   // reset cvars
   yb_quota.SetInt (0);
   yb_autovacate.SetInt (0);
}
开发者ID:xurubin,项目名称:yapb,代码行数:17,代码来源:control.cpp

示例3: Kick

void Bot::Kick (void)
{
   // this function kick off one bot from the server.

   ServerCommand ("kick #%d", GETPLAYERUSERID (GetEntity ()));
   CenterPrint ("Bot '%s' kicked", STRING (pev->netname));

   // balances quota
   if (g_botManager->GetBotsNum () - 1 < yb_quota.GetInt ())
      yb_quota.SetInt (g_botManager->GetBotsNum () - 1);
}
开发者ID:xurubin,项目名称:yapb,代码行数:11,代码来源:control.cpp

示例4: FillServer

void BotControl::FillServer (int selection, int personality, int skill, int numToAdd)
{
   // this function fill server with bots, with specified team & personality

   if (GetBotsNum () >= engine->GetMaxClients () - GetHumansNum ())
      return;

   if (selection == 1 || selection == 2)
   {
      CVAR_SET_STRING ("mp_limitteams", "0");
      CVAR_SET_STRING ("mp_autoteambalance", "0");
   }
   else
      selection = 5;

   char teamDescs[6][12] =
   {
      "",
      {"Terrorists"},
      {"CTs"},
      "",
      "",
      {"Random"},
   };

   int toAdd = numToAdd == -1 ? engine->GetMaxClients () - (GetHumansNum () + GetBotsNum ()) : numToAdd;

   for (int i = 0; i <= toAdd; i++)
   {
      // since we got constant skill from menu (since creation process call automatic), we need to manually
      // randomize skill here, on given skill there.
      int randomizedSkill = 0;

      if (skill >= 0 && skill <= 20)
         randomizedSkill = engine->RandomInt (0, 20);
      else if (skill >= 20 && skill <= 40)
         randomizedSkill = engine->RandomInt (20, 40);
      else if (skill >= 40 && skill <= 60)
         randomizedSkill = engine->RandomInt (40, 60);
      else if (skill >= 60 && skill <= 80)
         randomizedSkill = engine->RandomInt (60, 80);
      else if (skill >= 80 && skill <= 99)
         randomizedSkill = engine->RandomInt (80, 99);
      else if (skill == 100)
         randomizedSkill = skill;

      AddBot ("", randomizedSkill, personality, selection, -1);
   }

   yb_quota.SetInt (toAdd);
   CenterPrint ("Fill Server with %s bots...", &teamDescs[selection][0]);
}
开发者ID:xurubin,项目名称:yapb,代码行数:52,代码来源:control.cpp

示例5: AddBot

void BotControl::AddBot (const String &name, const String &skill, const String &personality, const String &team, const String &member)
{
   // this function is same as the function above, but accept as parameters string instead of integers

   CreateItem queueID;
   const String &any = "*";

   queueID.name = (name.IsEmpty () || (name == any)) ?  String ("\0") : name;
   queueID.skill = (skill.IsEmpty () || (skill == any)) ? -1 : (int)skill;
   queueID.team = (team.IsEmpty () || (team == any)) ? -1 : (int)team;
   queueID.member = (member.IsEmpty () || (member == any)) ? -1 : (int)member;
   queueID.personality = (personality.IsEmpty () || (personality == any)) ? -1 : (int)personality;

   m_creationTab.Push (queueID);

   // keep quota number up to date
   if (GetBotsNum () + 1 > yb_quota.GetInt ())
      yb_quota.SetInt (GetBotsNum () + 1);
}
开发者ID:xurubin,项目名称:yapb,代码行数:19,代码来源:control.cpp

示例6: RoundInit

void RoundInit (void)
{
   // this is called at the start of each round

   g_roundEnded = false;

   // SyPB Pro P.35 - Game Mode Setting
   if (GetGameMod() == 0)
   {
	   // check team economics
	   g_botManager->CheckTeamEconomics(TEAM_TERRORIST);
	   g_botManager->CheckTeamEconomics(TEAM_COUNTER);
   }

   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (g_botManager->GetBot (i))
         g_botManager->GetBot (i)->NewRound ();

      g_radioSelect[i] = 0;
   }
   g_waypoint->SetBombPosition (true);
   g_waypoint->ClearGoalScore ();

   // SyPB Pro P.38 - Zombie Mode Human Camp 
   g_waypoint->InitTypes(1);

   g_bombSayString = false;
   g_timeBombPlanted = 0.0f;
   g_timeNextBombUpdate = 0.0f;

   g_leaderChoosen[TEAM_COUNTER] = false;
   g_leaderChoosen[TEAM_TERRORIST] =  false;

   g_lastRadioTime[0] = 0.0f;
   g_lastRadioTime[1] = 0.0f;
   g_botsCanPause = false;

   g_entityIdAPI.RemoveAll();
   g_entityTeamAPI.RemoveAll();
   g_entityActionAPI.RemoveAll();

   // SyPB Pro P.15
   char *Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/plugins-dmkd.ini", GetModName());
   if (TryFileOpen(Plugin_INI))
   {
	   if (CVAR_GET_FLOAT("HsK_Deathmatch_Plugin_load_SyPB") == 1)
		   sypb_gamemod.SetInt(1);
	   else
		   sypb_gamemod.SetInt(0);
   }

   // SyPB Pro P.35 - ZP5.0 Fixed
   char *zpGameVersion[] =
   {
	   "plugins-zplague",  // ZP4.3
	   "plugins-zp50_ammopacks", // ZP5.0
	   "plugins-zp50_money" //ZP5.0
   };

   for (int i = 0; i < 3; i++)
   {
	   Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/%s.ini", GetModName(), zpGameVersion[i]);
	   if (TryFileOpen(Plugin_INI))
	   {
		   float delayTime = CVAR_GET_FLOAT("zp_delay") + 2.0f;
		   if (i != 0)
			   delayTime = CVAR_GET_FLOAT("zp_gamemode_delay") + 0.2f;

		   if (delayTime > 0)
		   {
			   sypb_gamemod.SetInt(2);
			   sypb_walkallow.SetInt(0);
			   //g_DelayTimer = engine->GetTime() + delayTime + 6.0f;

			   // SyPB Pro P.34 - ZP TIME FIXED
			   g_DelayTimer = engine->GetTime() + delayTime;// +1.99f;
			   break;
		   }
	   }
   }

   // SyPB Pro P.11
   Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/zombiehell.cfg", GetModName());
   if (TryFileOpen(Plugin_INI) && CVAR_GET_FLOAT("zh_zombie_maxslots") > 0)
   {
	   sypb_gamemod.SetInt(4);
	   sypb_walkallow.SetInt(0);

	   extern ConVar sypb_quota;
	   sypb_quota.SetInt(static_cast <int> (CVAR_GET_FLOAT("zh_zombie_maxslots")));
   }

   // SyPB Pro P.29 - Support CSBTE Final
   Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/bte_player.ini", GetModName());
   if (TryFileOpen(Plugin_INI))
   {
	   const int Const_GameModes = 13;
	   int bteGameModAi[Const_GameModes] =
	   {
//.........这里部分代码省略.........
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:101,代码来源:support.cpp

示例7: RoundInit

void RoundInit (void)
{
   // this is called at the start of each round

   g_roundEnded = false;

   // check team economics
   g_botManager->CheckTeamEconomics (TEAM_TERRORIST);
   g_botManager->CheckTeamEconomics (TEAM_COUNTER);

   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (g_botManager->GetBot (i))
         g_botManager->GetBot (i)->NewRound ();

      g_radioSelect[i] = 0;
   }
   g_waypoint->SetBombPosition (true);
   g_waypoint->ClearGoalScore ();

   g_bombSayString = false;
   g_timeBombPlanted = 0.0f;
   g_timeNextBombUpdate = 0.0f;

   g_leaderChoosen[TEAM_COUNTER] = false;
   g_leaderChoosen[TEAM_TERRORIST] =  false;

   g_lastRadioTime[0] = 0.0f;
   g_lastRadioTime[1] = 0.0f;
   g_botsCanPause = false;

   // SyPB Pro P.15
   char *Plugin_INI = FormatBuffer ("%s/addons/amxmodx/configs/plugins-dmkd.ini", GetModName ());
   if (TryFileOpen(Plugin_INI))
   {
	   if (CVAR_GET_FLOAT("HsK_Deathmatch_Plugin_load_SyPB") == 1)
		   sypb_gamemod.SetInt (1);
	   else
		   sypb_gamemod.SetInt (0);
   }

   // SyPB Pro P.2 // SyPB Pro P.15
   Plugin_INI = FormatBuffer ("%s/addons/amxmodx/configs/plugins-zplague.ini", GetModName ());
   if (TryFileOpen(Plugin_INI)) // Getting GameMod
   {
	   float delayTime = (CVAR_GET_FLOAT("zp_delay") >0) ? CVAR_GET_FLOAT("zp_delay") : CVAR_GET_FLOAT("zp_gamemode_delay");
   	   
   	   if (delayTime > 0)
   	   {
   	   	   sypb_gamemod.SetInt (2);
   	   	   sypb_walkallow.SetInt (0);
   	   	   g_DelayTimer = engine->GetTime () + delayTime + (CVAR_GET_FLOAT("mp_freezetime") / 2);  
   	   }
   }

   // SyPB Pro P.11
   Plugin_INI = FormatBuffer ("%s/addons/amxmodx/configs/zombiehell.cfg", GetModName ());
   if (TryFileOpen(Plugin_INI) && CVAR_GET_FLOAT("zh_zombie_maxslots") > 0)
   {
	   sypb_gamemod.SetInt (4);
	   sypb_walkallow.SetInt (0);

	   extern ConVar sypb_quota;
	   sypb_quota.SetInt (static_cast <int> (CVAR_GET_FLOAT("zh_zombie_maxslots")));
   }
   
   // SyPB Pro P.14
   Plugin_INI = FormatBuffer ("%s/addons/amxmodx/configs/bte_wpn.ini", GetModName ());
   if (TryFileOpen(Plugin_INI)) // This is CS:BTE
   {
   	   Plugin_INI = FormatBuffer ("%s/addons/amxmodx/configs/plugins-ze.ini", GetModName ());
   	   if ((g_mapType & MAP_ZE) && TryFileOpen(Plugin_INI))
   	   {
   	   	   sypb_gamemod.SetInt (99);
   	   	   sypb_walkallow.SetInt (0);
   	   	   g_DelayTimer = engine->GetTime () + 24.0f;
   	   }
   	   
   	   Plugin_INI = FormatBuffer ("%s/addons/amxmodx/configs/plugins-zb1.ini", GetModName ());
   	   if (TryFileOpen(Plugin_INI))
   	   {
   	   	   sypb_gamemod.SetInt (2);
   	   	   sypb_walkallow.SetInt (0);
   	   }
   }

   g_exp.UpdateGlobalKnowledge (); // update experience data on round start

   // calculate the round mid/end in world time
   g_timeRoundStart = engine->GetTime () + engine->GetFreezeTime ();
   g_timeRoundMid = g_timeRoundStart + engine->GetRoundTime () * 60 / 2;
   g_timeRoundEnd = g_timeRoundStart + engine->GetRoundTime () * 60;
}
开发者ID:n1992d,项目名称:SyPB,代码行数:93,代码来源:support.cpp

示例8: RoundInit

void RoundInit (void)
{
   // this is called at the start of each round

   g_roundEnded = false;

   // check team economics
   g_botManager->CheckTeamEconomics (TEAM_TERRORIST);
   g_botManager->CheckTeamEconomics (TEAM_COUNTER);

   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (g_botManager->GetBot (i))
         g_botManager->GetBot (i)->NewRound ();

      g_radioSelect[i] = 0;
   }
   g_waypoint->SetBombPosition (true);
   g_waypoint->ClearGoalScore ();

   g_bombSayString = false;
   g_timeBombPlanted = 0.0f;
   g_timeNextBombUpdate = 0.0f;

   g_leaderChoosen[TEAM_COUNTER] = false;
   g_leaderChoosen[TEAM_TERRORIST] =  false;

   g_lastRadioTime[0] = 0.0f;
   g_lastRadioTime[1] = 0.0f;
   g_botsCanPause = false;

   // SyPB Pro P.15
   char *Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/plugins-dmkd.ini", GetModName());
   if (TryFileOpen(Plugin_INI))
   {
	   if (CVAR_GET_FLOAT("HsK_Deathmatch_Plugin_load_SyPB") == 1)
		   sypb_gamemod.SetInt(1);
	   else
		   sypb_gamemod.SetInt(0);
   }

   // SyPB Pro P.2 // SyPB Pro P.15
   Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/plugins-zplague.ini", GetModName());
   if (TryFileOpen(Plugin_INI)) // Getting GameMod
   {
	   float delayTime = (CVAR_GET_FLOAT("zp_delay") >0) ? CVAR_GET_FLOAT("zp_delay") : CVAR_GET_FLOAT("zp_gamemode_delay");

	   if (delayTime > 0)
	   {
		   sypb_gamemod.SetInt(2);
		   sypb_walkallow.SetInt(0);
		   g_DelayTimer = engine->GetTime() + delayTime + (CVAR_GET_FLOAT("mp_freezetime") / 2);
	   }
   }

   // SyPB Pro P.11
   Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/zombiehell.cfg", GetModName());
   if (TryFileOpen(Plugin_INI) && CVAR_GET_FLOAT("zh_zombie_maxslots") > 0)
   {
	   sypb_gamemod.SetInt(4);
	   sypb_walkallow.SetInt(0);

	   extern ConVar sypb_quota;
	   sypb_quota.SetInt(static_cast <int> (CVAR_GET_FLOAT("zh_zombie_maxslots")));
   }

   // SyPB Pro P.29 - Support CSBTE Final
   Plugin_INI = FormatBuffer("%s/addons/amxmodx/configs/bte_player.ini", GetModName());
   if (TryFileOpen(Plugin_INI))
   {
	   const int Const_GameModes = 12;
	   int bteGameModAi[Const_GameModes] =
	   {
		   0, 0, 1, 3, 0, 2, 2, 2, 2, 4, 2, 3
	   };//n, t, d, d, g, g, z, z, z, z, z, n

	   char *bteGameINI[Const_GameModes] =
	   {
		   "plugins-none",
		   "plugins-td",
		   "plugins-dm",
		   "plugins-dr",
		   "plugins-gd",
		   "plugins-ghost",
		   "plugins-zb1",
		   "plugins-zb3",
		   "plugins-zb4",
		   "plugins-ze",
		   "plugins-zse",
		   "plugins-npc"
	   };

	   for (int i = 0; i < Const_GameModes; i++)
	   {
		   if (TryFileOpen(FormatBuffer("%s/addons/amxmodx/configs/%s.ini", GetModName(), bteGameINI[i])))
		   {
			   sypb_gamemod.SetInt(bteGameModAi[i]);

			   if (bteGameModAi[i] == 2 && i != 5)
			   {
//.........这里部分代码省略.........
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:101,代码来源:support.cpp


注:本文中的ConVar::SetInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。