-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated wrappers & call layouts
- Loading branch information
Showing
4 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- | ||
-- Check out our the Wiki! | ||
-- http://wiki.gtalua.com/index.php/Main_Page | ||
-- http://wiki.gtalua.com/index.php/Getting_Started | ||
-- http://wiki.gtalua.com/index.php/API | ||
-- | ||
-- I recommend matching addon name & script thread name | ||
example_events = ScriptThread("example_05_events") | ||
|
||
-- OnPedCreated Handler | ||
function example_events:EventHandler_PedCreated(ped_id) | ||
-- Only touch the entity shortly later! | ||
-- It might be instantly deleted again from a game script | ||
timer.Simple(200, function() | ||
-- Note: an ID is passed! not a Ped class | ||
local ped = Ped(ped_id) | ||
|
||
-- Always make sure that it exists | ||
if not ped:Exists() then return end | ||
|
||
-- Add Blip for them | ||
ped:AttachBlip() | ||
end) | ||
end | ||
|
||
-- OnVehicleCreated Handler | ||
function example_events:EventHandler_VehicleCreated(vehicle_id) | ||
timer.Simple(2000, function() | ||
local vehicle = Vehicle(vehicle_id) | ||
if not vehicle:Exists() then return end | ||
|
||
-- Blip | ||
vehicle:AttachBlip() | ||
|
||
-- Neon Lights | ||
vehicle:SetNeonLights(true, math.random(0,255), math.random(0,255), math.random(0,255)) | ||
end) | ||
end | ||
|
||
-- Run | ||
function example_events:Run() | ||
-- Add Handler | ||
example_events:AddEventHandler("OnPedCreated", "EventHandler_PedCreated") | ||
example_events:AddEventHandler("OnVehicleCreated", "EventHandler_VehicleCreated") | ||
end | ||
|
||
-- Register | ||
example_events:Register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters