Personal tools

Lua/Events/Shared/EntitySpawn

From JC2-MP Documentation

< Lua
Jump to: navigation, search
Name    EntitySpawn
Arguments (in table)    object entity
Return option    None


Description

entity can be one of:

  • Player
  • Vehicle
  • Checkpoint
  • StaticObject
  • ClientStaticObject
  • ClientEffect
  • ClientSound

To get the type, use args.entity.__type.

Vehicles count as spawned when they automatically respawn.

On the client, when objects are streamed in, they fire the event as well, not just when they are created.

Example

function Foo(args)
	print("A "..args.entity.__type.." just spawned.")
end
 
Events:Subscribe("EntitySpawn", Foo)