fl1k Posted August 18, 2021 Posted August 18, 2021 [ServerEvent(Event.PlayerDeath)] public static async Task OnPlayerDeath(GTANetworkAPI.Player player, GTANetworkAPI.Player killer, DeathReason deathReason) { Player.AccountData account = player.GetData<Player.AccountData>(Player.AccountData.UniqueIdentifier); Player.SessionData session = player.GetData<Player.SessionData>(Player.SessionData.UniqueIdentifier); int medicalFee = session.ClassData.MedicalFeeOnDeath + random.Next(-200, 200); account.Deaths++; account.Balance -= medicalFee; player.SendChatMessage($"You've died and have paid {medicalFee}$ in medical fees."); Vector3 spawnPos = new Vector3(); if (account.SpawnLocation == SpawnLocation.Random) spawnPos = new Vector3(-1036.182, -2729.434, 13.75665); await Task.Delay(5000); NAPI.Player.SpawnPlayer(player, spawnPos); } Hi, I'd like to make it so once the player dies there is a timer of 5 seconds before he is respawned Could someone put me in the right direction, this is the code I came up with but it doesn't work
fl1k Posted August 18, 2021 Author Posted August 18, 2021 Solved [code] NAPI.Task.Run(() => { NAPI.Player.SpawnPlayer(player, spawnPos); }, 5000); [/code]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now