Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- getMaterialCustomShaderFilename
- getMaterialCustomShaderVariation
- getMaterialDiffuseMapFilename
- getMaterialDiffuseMapHasAlpha
- getMaterialEmissiveMapFilename
- getMaterialEmissiveMapHasAlpha
- getMaterialGlossMapFilename
- getMaterialHasRefractionMap
- getMaterialIsAlphaBlended
- getMaterialIsAlphaTested
- getMaterialNormalMapFilename
- getMaterialNormalMapFormat
- getMaterialReflectionMapScaling
- setMaterialCustomMapFromFile
- setMaterialCustomShaderVariation
- setMaterialDiffuseMapFromFile
- setMaterialGlossMapFromFile
- setMaterialNormalMapFromFile
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
PlayerTeleportEvent
ParentEventFunctions
emptyNew
DescriptionCreate an empty instanceDefinition
emptyNew()Return Values
table | instance | Instance of object |
11 | function PlayerTeleportEvent.emptyNew() |
12 | local self = Event.new(PlayerTeleportEvent_mt) |
13 | return self |
14 | end |
new
DescriptionCreate an instanceDefinition
new(float x, float y, float z, bool isAbsolute, bool isRootNode, float z)Arguments
float | x | world x position |
float | y | world y position |
float | z | world z position |
bool | isAbsolute | if not true, y is a delta from the terrain |
bool | isRootNode | if true, y is the root node location, otherwise y is the feet location |
float | z | world z position |
table | instance | Instance of object |
25 | function PlayerTeleportEvent.new(x, y, z, isAbsolute, isRootNode) |
26 | local self = PlayerTeleportEvent.emptyNew() |
27 | self.x = x |
28 | self.y = y |
29 | self.z = z |
30 | self.isAbsolute = isAbsolute |
31 | self.isRootNode = isRootNode |
32 | return self |
33 | end |
newExitVehicle
DescriptionCreate an instance when player exits vehicleDefinition
newExitVehicle(table exitVehicle)Arguments
table | exitVehicle | instance of the vehicle that the player exits |
table | instance | Instance of object |
39 | function PlayerTeleportEvent.newExitVehicle(exitVehicle) |
40 | local self = PlayerTeleportEvent.emptyNew() |
41 | self.exitVehicle = exitVehicle |
42 | return self |
43 | end |
readStream
DescriptionReads network streamDefinition
readStream(integer streamId, table connection)Arguments
integer | streamId | network stream identification |
table | connection | connection information |
49 | function PlayerTeleportEvent:readStream(streamId, connection) |
50 | if streamReadBool(streamId) then |
51 | self.exitVehicle = NetworkUtil.readNodeObject(streamId) |
52 | else |
53 | self.x = streamReadFloat32(streamId) |
54 | self.y = streamReadFloat32(streamId) |
55 | self.z = streamReadFloat32(streamId) |
56 | self.isAbsolute = streamReadBool(streamId) |
57 | self.isRootNode = streamReadBool(streamId) |
58 | end |
59 | self:run(connection) |
60 | end |
run
DescriptionRun eventDefinition
run(table connection)Arguments
table | connection | connection information |
81 | function PlayerTeleportEvent:run(connection) |
82 | if not connection:getIsServer() then |
83 | local player = g_currentMission.connectionsToPlayer[connection] |
84 | if player ~= nil then |
85 | if self.exitVehicle ~= nil then |
86 | player:moveToExitPoint(self.exitVehicle) |
87 | elseif self.x ~= nil then |
88 | player:moveTo(self.x,self.y,self.z,self.isAbsolute,self.isRootNode) |
89 | end |
90 | end |
91 | end |
92 | end |
writeStream
DescriptionWrites network streamDefinition
writeStream(integer streamId, table connection)Arguments
integer | streamId | network stream identification |
table | connection | connection information |
66 | function PlayerTeleportEvent:writeStream(streamId, connection) |
67 | if streamWriteBool(streamId, self.exitVehicle ~= nil) then |
68 | NetworkUtil.writeNodeObject(streamId, self.exitVehicle) |
69 | else |
70 | streamWriteFloat32(streamId, self.x) |
71 | streamWriteFloat32(streamId, self.y) |
72 | streamWriteFloat32(streamId, self.z) |
73 | streamWriteBool(streamId, self.isAbsolute) |
74 | streamWriteBool(streamId, self.isRootNode) |
75 | end |
76 | end |