forked from Simnation/Main
ed
This commit is contained in:
parent
7fb00900b0
commit
e6e25aa23e
2 changed files with 126 additions and 134 deletions
|
@ -171,6 +171,10 @@ RegisterNetEvent('tdm:playerHit', function()
|
|||
local spawnPoints = fieldConfig.teamSpawns[currentTeam]
|
||||
local randomSpawn = spawnPoints[math.random(#spawnPoints)]
|
||||
|
||||
-- Bildschirm ausblenden für sauberen Teleport
|
||||
DoScreenFadeOut(500)
|
||||
Wait(500)
|
||||
|
||||
-- Animation stoppen
|
||||
ClearPedTasks(ped)
|
||||
|
||||
|
@ -185,6 +189,10 @@ RegisterNetEvent('tdm:playerHit', function()
|
|||
SetBlipFlashes(teamZoneBlips[currentTeam], false)
|
||||
end
|
||||
|
||||
-- Bildschirm wieder einblenden
|
||||
Wait(100)
|
||||
DoScreenFadeIn(500)
|
||||
|
||||
lib.notify({
|
||||
title = 'TeamDeathmatch',
|
||||
description = 'Du bist wieder im Spiel!',
|
||||
|
@ -451,7 +459,6 @@ function openJoinGameMenu(fieldId)
|
|||
})
|
||||
return
|
||||
end
|
||||
|
||||
TriggerServerEvent('tdm:requestGamesList')
|
||||
|
||||
Wait(200)
|
||||
|
@ -566,13 +573,25 @@ CreateThread(function()
|
|||
local ped = PlayerPedId()
|
||||
|
||||
if HasEntityBeenDamagedByAnyPed(ped) then
|
||||
local damager = GetPedSourceOfDeath(ped)
|
||||
local damager = NetworkGetEntityKillerOfPlayer(PlayerId())
|
||||
local damagerPlayer = nil
|
||||
|
||||
for _, player in pairs(GetActivePlayers()) do
|
||||
if GetPlayerPed(player) == damager then
|
||||
damagerPlayer = GetPlayerServerId(player)
|
||||
break
|
||||
-- Versuche den Angreifer zu identifizieren
|
||||
if damager > 0 then
|
||||
damagerPlayer = NetworkGetPlayerIndexFromPed(damager)
|
||||
if damagerPlayer then
|
||||
damagerPlayer = GetPlayerServerId(damagerPlayer)
|
||||
end
|
||||
end
|
||||
|
||||
-- Alternativ über alle Spieler suchen
|
||||
if not damagerPlayer then
|
||||
for _, player in ipairs(GetActivePlayers()) do
|
||||
local playerPed = GetPlayerPed(player)
|
||||
if playerPed == GetPedSourceOfDeath(ped) then
|
||||
damagerPlayer = GetPlayerServerId(player)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -678,7 +697,6 @@ RegisterNetEvent('tdm:openFieldMenu', function(data)
|
|||
end
|
||||
end)
|
||||
|
||||
|
||||
-- Chat Command zum Spiel verlassen
|
||||
RegisterCommand('leavetdm', function()
|
||||
if inTDM then
|
||||
|
@ -758,3 +776,36 @@ RegisterCommand('removemask', function()
|
|||
type = 'info'
|
||||
})
|
||||
end, false)
|
||||
|
||||
-- Debug-Funktion für Respawn
|
||||
RegisterCommand('forcetdmrespawn', function()
|
||||
if inTDM and currentTeam and currentField then
|
||||
local ped = PlayerPedId()
|
||||
local fieldConfig = Config.gameFields[currentField]
|
||||
local spawnPoints = fieldConfig.teamSpawns[currentTeam]
|
||||
local randomSpawn = spawnPoints[math.random(#spawnPoints)]
|
||||
|
||||
DoScreenFadeOut(500)
|
||||
Wait(500)
|
||||
|
||||
ClearPedTasks(ped)
|
||||
SetEntityCoords(ped, randomSpawn.x, randomSpawn.y, randomSpawn.z)
|
||||
isHit = false
|
||||
|
||||
Wait(100)
|
||||
DoScreenFadeIn(500)
|
||||
|
||||
lib.notify({
|
||||
title = 'Debug',
|
||||
description = 'Manueller Respawn durchgeführt!',
|
||||
type = 'success'
|
||||
})
|
||||
else
|
||||
lib.notify({
|
||||
title = 'Debug',
|
||||
description = 'Du bist nicht in einem TDM-Spiel!',
|
||||
type = 'error'
|
||||
})
|
||||
end
|
||||
end, false)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue