NEW: Core Setup
This commit is contained in:
19
core/cl_core.lua
Normal file
19
core/cl_core.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
function GB.Core.Start(self)
|
||||||
|
Citizen.CreateThread(function()
|
||||||
|
while true do
|
||||||
|
if NetworkIsSessionStarted() then
|
||||||
|
TriggerEvent('gb-core:start')
|
||||||
|
TriggerServerEvent('gb-core:serverStart')
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
GB.Core.Start(self)
|
||||||
|
|
||||||
|
RegisterNetEvent('gb-core:client:getObject')
|
||||||
|
AddEventHandler('gb-core:client:getObject', function(callback)
|
||||||
|
callback(GB)
|
||||||
|
print('Called back ' .. GB .. )
|
||||||
|
end)
|
||||||
35
core/sv_core.lua
Normal file
35
core/sv_core.lua
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
RegisterServerEvent('gb-core:serverStart')
|
||||||
|
AddEventHandler('gb-core:serverStart', function()
|
||||||
|
local src = source
|
||||||
|
Citizen.CreateThread(function()
|
||||||
|
local identifier = GetPlayerIdentifiers(src)[1] -- gets IDENTIFIER:1234567890
|
||||||
|
if not identifier then
|
||||||
|
DropPlayer(src, "Identifier not located.") -- Removes player if not found
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('gb-core:server:getObject')
|
||||||
|
AddEventHandler('gb-core:server:getObject', function(callback)
|
||||||
|
callback(GB)
|
||||||
|
end)
|
||||||
|
|
||||||
|
--// COMMANDS \\--
|
||||||
|
AddEventHandler('gb-core:addCommand', function(command, callback, suggestion, args)
|
||||||
|
GB.Functions.addCommand(command, callback, suggestion, args)
|
||||||
|
end)
|
||||||
|
|
||||||
|
AddEventHandler('gb-core:addGroupCommand', function(command, group, callback, callbackfailed, suggestion, args)
|
||||||
|
GB.Functions.addGroupCommand(command, group, callback, callbackfailed, suggestion, args)
|
||||||
|
end)
|
||||||
|
|
||||||
|
--// CALLBACK SERVER \\--
|
||||||
|
RegisterServerEvent('gb-core:server:triggerServerCallback')
|
||||||
|
AddEventHandler('gb-core:server:triggerServerCallback', function(name, requestId, ...)
|
||||||
|
local src = source
|
||||||
|
|
||||||
|
GB.Functions.TriggerServerCallback(name, requestId, src, function(...)
|
||||||
|
TriggerClientEvent('gb-core:client:serverCallback', src, requestId, ...)
|
||||||
|
end, ...)
|
||||||
|
end)
|
||||||
17
fxmanifest.lua
Normal file
17
fxmanifest.lua
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
fx_version 'cerulean'
|
||||||
|
games 'gta5'
|
||||||
|
|
||||||
|
author 'gb-framework'
|
||||||
|
description 'n/a'
|
||||||
|
version '0.0.1'
|
||||||
|
|
||||||
|
-- dependency 'ghmattimysql'
|
||||||
|
|
||||||
|
client_scripts {
|
||||||
|
'core/cl_core.lua'
|
||||||
|
}
|
||||||
|
|
||||||
|
server_scripts {
|
||||||
|
'core/sv_core.lua'
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user