update TeamManager
This commit is contained in:
parent
39d4e187c2
commit
4e32bbf7ee
@ -6,6 +6,8 @@
|
||||
|
||||
#define MIN_PLAYERS 2
|
||||
|
||||
Handle g_hWarmupEndFwd;
|
||||
|
||||
int g_iWarmup = 0;
|
||||
bool g_bWarmup = false;
|
||||
ConVar g_CVar_sm_warmuptime;
|
||||
@ -24,6 +26,15 @@ public Plugin myinfo =
|
||||
url = "https://github.com/CSSZombieEscape/sm-plugins/tree/master/TeamManager"
|
||||
};
|
||||
|
||||
public APLRes AskPluginLoad2(Handle hThis, bool bLate, char[] err, int iErrLen)
|
||||
{
|
||||
CreateNative("TeamManager_InWarmup", Native_InWarmup);
|
||||
|
||||
RegPluginLibrary("TeamManager");
|
||||
|
||||
return APLRes_Success;
|
||||
}
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
if (GetEngineVersion() == Engine_CSGO)
|
||||
@ -36,6 +47,8 @@ public void OnPluginStart()
|
||||
g_CVar_sm_warmuptime = CreateConVar("sm_warmuptime", "10", "Warmup timer.", 0, true, 0.0, true, 60.0);
|
||||
g_CVar_sm_warmupratio = CreateConVar("sm_warmupratio", "0.60", "Ratio of connected players that need to be in game to start warmup timer.", 0, true, 0.0, true, 1.0);
|
||||
|
||||
g_hWarmupEndFwd = CreateGlobalForward("TeamManager_WarmupEnd", ET_Ignore);
|
||||
|
||||
AutoExecConfig(true, "plugin.TeamManager");
|
||||
}
|
||||
|
||||
@ -74,7 +87,9 @@ public Action OnWarmupTimer(Handle timer)
|
||||
{
|
||||
g_iWarmup = 0;
|
||||
g_bWarmup = false;
|
||||
CS_TerminateRound(3.0, CSRoundEnd_GameStart, false);
|
||||
float fDelay = 3.0;
|
||||
CS_TerminateRound(fDelay, CSRoundEnd_GameStart, false);
|
||||
CreateTimer(fDelay, Timer_FireForward, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
@ -84,6 +99,13 @@ public Action OnWarmupTimer(Handle timer)
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action Timer_FireForward(Handle hThis)
|
||||
{
|
||||
Call_StartForward(g_hWarmupEndFwd);
|
||||
Call_Finish();
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
g_TeamChangeQueue[client] = -1;
|
||||
@ -98,7 +120,7 @@ public Action OnJoinTeamCommand(int client, const char[] command, int argc)
|
||||
{
|
||||
if(GetClientTeam(client) != CS_TEAM_NONE)
|
||||
return Plugin_Continue;
|
||||
|
||||
|
||||
ShowVGUIPanel(client, "team");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
@ -204,3 +226,8 @@ public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect,
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public int Native_InWarmup(Handle hPlugin, int numParams)
|
||||
{
|
||||
return g_bWarmup;
|
||||
}
|
||||
|
36
TeamManager/scripting/include/TeamManager.inc
Normal file
36
TeamManager/scripting/include/TeamManager.inc
Normal file
@ -0,0 +1,36 @@
|
||||
#if defined _TeamManager_include
|
||||
#endinput
|
||||
#endif
|
||||
#define _TeamManager_include
|
||||
|
||||
/**
|
||||
* Called when warmup ends
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
forward void TeamManager_WarmupEnd();
|
||||
|
||||
/**
|
||||
* Returns the status of warmup
|
||||
*
|
||||
* @return bool inwarmup
|
||||
*/
|
||||
native bool TeamManager_InWarmup();
|
||||
|
||||
public SharedPlugin __pl_TeamManager =
|
||||
{
|
||||
name = "TeamManager",
|
||||
file = "TeamManager.smx",
|
||||
#if defined REQUIRE_PLUGIN
|
||||
required = 1
|
||||
#else
|
||||
required = 0
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !defined REQUIRE_PLUGIN
|
||||
public void __pl_TeamManager_SetNTVOptional()
|
||||
{
|
||||
MarkNativeAsOptional("TeamManager_InWarmup");
|
||||
}
|
||||
#endif
|
1
includes/TeamManager.inc
Symbolic link
1
includes/TeamManager.inc
Symbolic link
@ -0,0 +1 @@
|
||||
../TeamManager/scripting/include/TeamManager.inc
|
Loading…
Reference in New Issue
Block a user