Multi Theft Auto: Wiki:OnVehicleSpawn: Difference between revisions
Jump to navigation
Jump to search
Godpolice13 (talk | contribs) No edit summary |
Godpolice13 (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
<pageclass class="resource" subcaption="Resource"></pageclass> | <pageclass class="resource" subcaption="Resource"></pageclass> | ||
This Serverside Script adds the function: onVehicleSpawn. | |||
<div style="padding:10px; border-radius:2px;font-size:14px;"> | <div style="padding:10px; border-radius:2px;font-size:14px;"> | ||
Revision as of 16:02, 8 January 2021
This Serverside Script adds the function: onVehicleSpawn.
Source: https://google.com
Source
The source of this event is the vehicle that spawned.
Code
Click to collapse [-]
Clientside ScriptaddEventHandler("onClientElementStreamIn", root, function()
if getElementType(source) == "vehicle" then
triggerServerEvent("onVehicleSpawnCheck", localPlayer, source)
end
end)
Click to collapse [-]
Serverside ScriptaddEvent("onVehicleSpawn", true)
function onVehicleSpawnCheck(vehicle)
triggerEvent("onVehicleSpawn", vehicle)
end
addEvent("onVehicleSpawnCheck", true)
addEventHandler("onVehicleSpawnCheck", root, onVehicleSpawnCheck)