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 5: | Line 5: | ||
'''Source''': https://google.com | '''Source''': https://google.com | ||
</div> | </div> | ||
==Code== | |||
<section name="Clientside Script" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
addEventHandler("onClientElementStreamIn", root, function() | |||
if getElementType(source) == "vehicle" then | |||
triggerServerEvent("onVehicleSpawnCheck", localPlayer, source) | |||
end | |||
end) | |||
</syntaxhighlight> | |||
</section> | |||
<section name="Serverside Script" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
addEvent("onVehicleSpawn", true) | |||
function onVehicleSpawnCheck(vehicle) | |||
triggerEvent("onVehicleSpawn", vehicle) | |||
end | |||
addEvent("onVehicleSpawnCheck", true) | |||
addEventHandler("onVehicleSpawnCheck", root, onVehicleSpawnCheck) | |||
</syntaxhighlight> | |||
</section> | |||
Revision as of 15:59, 8 January 2021
blabl
Source: https://google.com
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)