Jump to content

Recommended Posts

Hello. I am doing a multiplayer mission where a record of destroyed (lost) aircraft is kept. For this counter, I need a check at:

Crash - it hit the ground (Client)

Pilot dead - The pilot died (Client)

Pilot ejected - The pilot ejected (Client)

 

How to do it through the lua script?

 

 

I fulfill the condition for the destruction of the plane with the destruction triggers. But so that it does not work when changing roles, I set a condition: the altitude of the object is more than 5 meters. But then the trigger does not work if the player crashed himself (hit the ground).


Edited by Hollander
Link to post
Share on other sites

Only clients/players return a value (string) for getPlayerName(), so you could try something like this:

 

function Handler:onEvent(event)
if event.id == world.event.S_EVENT_CRASH then		
	local ei = event.initiator
	if ei == nil then			
		return
	end
	local playerName = ei:getPlayerName()		
	-- ...
	if playerName ~= nil then 
		-- ...
	end
	-- ...
end
end

Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...