Commit 4dea0a85 authored by Mikleo's avatar Mikleo
Browse files

Fix game start stuck bug. (eastborough)

parent 80366900
Pipeline #11302 passed with stages
in 28 seconds
......@@ -4,7 +4,7 @@
#include <sdktools>
#include <sdkhooks>
#define PluginVersion "0.23"
#define PluginVersion "0.24"
#undef REQUIRE_PLUGIN
#include <updater>
......@@ -88,10 +88,10 @@ int currentwaitTime;
public void OnPluginStart()
{
//Hook events
HookEvent("commander_vote_time", Event_CommwaitTime);
HookEvent("commander_elected_player", Event_Elected_Player);
HookEvent("player_team", Event_PlayerTeam, EventHookMode_Post);
HookEvent("commander_vote", Event_Comm_Vote, EventHookMode_Post);
HookEvent("vehicle_enter", Event_VehicleEnter, EventHookMode_Post);
......@@ -120,14 +120,14 @@ public void OnPluginStart()
AddCommandListener(Command_Plugin_Version, "eu_version");
Initialize();
//ChatTriggers = new StringMap();
if (LibraryExists("updater"))
{
Updater_AddPlugin(UPDATE_URL);
}
//ChatTriggers = new StringMap();
}
public void OnLibraryAdded(const char[] name)
{
......@@ -142,9 +142,18 @@ public void OnLibraryAdded(const char[] name)
void UpdateParamEntity()
{
if(paramEntity < 1)
{
paramEntity = FindEntityByClassname(-1, "emp_info_params");
if(paramEntity >1)
HookSingleEntityOutput(paramEntity,"OnWaitPhaseEnd",OnOutput_WaitPhaseEnd);
}
}
public void OnOutput_WaitPhaseEnd(const char[] output, int caller, int activator, float delay)
{
CheckGameStarted();
}
void UpdateResourceEntity()
{
if(resourceEntity < 1)
......@@ -176,9 +185,7 @@ Initialize()
leaderVotes[2] = 0;
leaderVotes[3] = 0;
// hookevent to check game start
HookEvent("player_spawn",SpawnEvent);
CheckGameStarted();
......@@ -234,16 +241,6 @@ public Action CheckCommExists(Handle timer)
public Action:SpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new client_id = GetEventInt(event, "userid");
new client = GetClientOfUserId(client_id);
if(GetClientTeam(client) >= 2 && !IsFakeClient(client) )
{
CheckGameStarted(true);
}
}
public OnMapStart()
{
......@@ -310,22 +307,9 @@ public Action Event_CommwaitTime(Handle:event, const char[] name, bool dontBroad
}
if(currentwaitTime == 0)
{
CreateTimer(1.1, Timer_CheckGameStarted);
CreateTimer(1.5, Timer_CheckGameStarted);
}
}
public Action Timer_CheckGameStarted(Handle timer)
{
CheckGameStarted();
// two 0's means game has started, on infantry maps as well.
}
public Event_Elected_Player(Handle:event, const char[] name, bool dontBroadcast)
{
CheckGameStarted();
}
// there is a possibility this fires just after commander has opted out. So we need check if they are opted in.
public Action Event_Comm_Vote(Event event, const char[] name, bool dontBroadcast)
......@@ -421,8 +405,6 @@ CheckGameStarted(bool force = false)
Call_Finish();
execConfig("game_start");
UnhookEvent("player_spawn",SpawnEvent);
}
}
......
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "0.23"
"Latest" "0.24"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment