Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modded class DayZGame
- {
- private int m_CustomQueueTime;
- private bool m_NewCharacter;
- private bool m_CanSpawn;
- private bool m_Complete;
- private bool m_IsRespawn = false;
- private string m_LoadoutJson;
- ref array<ref Param> m_CustomizationParams;
- void DayZGame()
- {
- m_CustomQueueTime = 0;
- m_Complete = false;
- Print("DayZ Vanilla PlusPlus!");
- }
- void UpdateCharacterItems(ref array<ref Param> params)
- {
- if (params)
- {
- m_CustomizationParams = new array<ref Param>;
- m_CustomizationParams = params;
- }
- }
- void ProcessLoadout()
- {
- if (!m_Complete)
- {
- m_Complete = true;
- Param2<string,string> oParams = new Param2<string,string>(m_LoadoutJson,GetGame().GetPlayer().GetIdentity().GetId());
- GetRPCManager().SendRPC( "RPC_SpawnStartKit", "SpawnStartKit", oParams, true );
- GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(this.ResetMemes, 2200, false);
- }
- }
- int GetQueueTime()
- {
- return m_CustomQueueTime;
- }
- void SetSelectedLoadout(string JsonData)
- {
- m_LoadoutJson = JsonData;
- }
- void IsReadyToSpawn()
- {
- if (m_CustomizationParams != NULL)
- {
- m_CanSpawn = true;
- }
- else
- {
- m_CanSpawn = false;
- }
- }
- void ResetMemes()
- {
- m_Complete = false;
- m_CustomizationParams = NULL;
- }
- void TriggerRespawn()
- {
- m_IsRespawn = true;
- }
- override void CancelQueueTime()
- {
- if (m_NewCharacter)
- {
- GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(this.ProcessLoadout, 1200, false);
- }
- m_NewCharacter = false;
- m_CanSpawn = false;
- m_CustomQueueTime = 0;
- m_Complete = false;
- GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(this.ClientSpawning);
- GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(this.IsReadyToSpawn);
- }
- // ------------------------------------------------------------
- override void OnClientSpawningEvent(int queueTime, bool newChar)
- {
- if (newChar)
- {
- m_CustomQueueTime = 120;
- m_NewCharacter = true;
- GetUIManager().EnterScriptedMenu( VPP_MENU_SPAWN_SCENE, NULL );
- }
- else
- {
- m_CustomQueueTime = queueTime;
- GetGame().SetEVUser(-5);
- m_NewCharacter = false;
- }
- //Count down part
- GetGame().GetUserManager().GetUserDatabaseIdAsync();
- if (m_CustomQueueTime > 0)
- {
- GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.ClientSpawning, 1000, true, newChar);
- GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.IsReadyToSpawn, 100, true);
- }
- }
- // ------------------------------------------------------------
- override void ClientSpawning(bool newChar)
- {
- if (m_NewCharacter)
- {
- //Waiting....for player to select gear.
- m_CustomQueueTime --;
- if (m_CustomQueueTime <= 0)
- {
- if (m_CanSpawn)
- {
- ClientSpawningFinished(newChar);
- GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
- }
- else
- {
- //TODO: Kick/Disconnect Fucntion
- Print("Timesup....Kick");
- g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().DisconnectSessionForce);
- GetGame().GetUIManager().Back();
- GetGame().GetUIManager().CloseDialog();
- GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
- }
- }
- else if (m_CanSpawn) //Player Finished selecting b4 timer...process spawn
- {
- ClientSpawningFinished(newChar);
- GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
- }
- }
- else
- {
- if (m_CustomQueueTime >= 0)
- {
- #ifndef NO_GUI
- string text = "#dayz_game_spawning_in" + " " + m_CustomQueueTime.ToString() + " " + "#dayz_game_seconds";
- GetUIManager().ScreenFadeIn(0, text, FadeColors.BLACK, FadeColors.WHITE);
- m_CustomQueueTime --;
- #endif
- }
- else
- {
- ClientSpawningFinished(newChar);
- GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.CancelQueueTime, 2000, false);
- }
- }
- }
- // ------------------------------------------------------------
- override void ClientSpawningFinished(bool newChar)
- {
- super.ClientSpawningFinished(newChar);
- }
- override void StoreLoginData()
- {
- if (m_NewCharacter && !m_IsRespawn)
- {
- GetGame().StoreLoginData(m_CustomizationParams);
- }
- else if (m_IsRespawn)
- {
- GetGame().StoreLoginData(m_CustomizationParams);
- }
- else if (!m_NewCharacter && !m_IsRespawn)
- {
- ref array<ref Param> mParams = new array<ref Param>;
- ref Param topParam = new Param1<int>(-1);
- mParams.Insert(topParam);
- ref Param bottomParam = new Param1<int>(-1);
- mParams.Insert(bottomParam);
- ref Param shoesParam = new Param1<int>(-1);
- mParams.Insert(shoesParam);
- ref Param skinParam = new Param1<int>(-1);
- mParams.Insert(skinParam);
- GetGame().StoreLoginData(mParams);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement