-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiplloader_c.lua
More file actions
50 lines (45 loc) · 1.41 KB
/
iplloader_c.lua
File metadata and controls
50 lines (45 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--[[
- Loads any IPL files as advised by the server
-
- @author: 3aGl3
- @team: SOG Modding
-
- @project: IPL Helper
- @website: http://sogmods.net/
-
]]
-- register networking events
RegisterNetEvent( "_IplHelper:RequestIPL" )
RegisterNetEvent( "_IplHelper:RemoveIPL" )
--[[
- Handles requests by the server to request the given IPL file
]]
local function OnServerRequestIPL( name )
Citizen.Trace( "Received IPL Request from Server: ".. name .."\n" )
-- check if the IPL isn't already active, then load it
if not IsIplActive(name) then
RequestIpl(name)
end
end --[[ OnServerRequestIPL ]]
AddEventHandler( "_IplHelper:RequestIPL", OnServerRequestIPL )
--[[
- Handles requests by the server to remove the given IPL file
]]
local function OnServerRemoveIPL( name )
Citizen.Trace( "Received IPL Remove from Server: ".. name .."\n" )
-- check if the IPL is even active, then remove it
if IsIplActive(name) then
RemoveIpl(name)
end
end --[[ OnServerRemoveIPL ]]
AddEventHandler( "_IplHelper:RemoveIPL", OnServerRemoveIPL )
--[[
- Requests all currently loaded IPL files from the server when the resource starts
]]
local function OnClientResourceStart( name )
if name == GetCurrentResourceName() then
Citizen.Trace( "Starting IPL Helper, requesting current IPL files...\n" )
TriggerServerEvent( "_IplHelper:RequestAllIPL" )
end
end --[[ OnClientResourceStart ]]
AddEventHandler( "onClientResourceStart", OnClientResourceStart )