From f9936dc41dbb0f0f7dcf9d3ff4841376d4381247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 13 Sep 2017 14:48:38 +0200 Subject: [PATCH] Fix typo + add some events --- client/main.lua | 18 +++++++++++------- server/main.lua | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/client/main.lua b/client/main.lua index 7852e340..9120d0ab 100644 --- a/client/main.lua +++ b/client/main.lua @@ -37,7 +37,7 @@ function CloseInstance() end function EnterInstance(instance) - + TriggerServerEvent('instance:enter', instance.host) if RegisteredInstanceTypes[instance.type].enter ~= nil then @@ -63,8 +63,8 @@ function LeaveInstance() end -function InviteToInstance(type, player, pos) - TriggerServerEvent('instance:invite', Instance.host, type, player, pos) +function InviteToInstance(type, player, data) + TriggerServerEvent('instance:invite', Instance.host, type, player, data) end function RegisterInstanceType(type, enter, exit) @@ -94,8 +94,8 @@ AddEventHandler('instance:leave', function() LeaveInstance() end) -AddEventHandler('instance:invite', function(type, player, pos) - InviteToInstance(type, player, pos) +AddEventHandler('instance:invite', function(type, player, data) + InviteToInstance(type, player, data) end) AddEventHandler('instance:registerType', function(name, enter, exit) @@ -130,13 +130,13 @@ end) RegisterNetEvent('instance:onPlayerEntered') AddEventHandler('instance:onPlayerEntered', function(instance, player) Instance = instance - ShowNotification(GetPlayerName(GetPlayerFromServerId(player)) .. _U('entered_into')) + ShowNotification(GetPlayerName(GetPlayerFromServerId(player)) .. _('entered_into')) end) RegisterNetEvent('instance:onPlayerLeft') AddEventHandler('instance:onPlayerLeft', function(instance, player) Instance = instance - ShowNotification(GetPlayerName(GetPlayerFromServerId(player)) .. _U('left_out')) + ShowNotification(GetPlayerName(GetPlayerFromServerId(player)) .. _('left_out')) end) RegisterNetEvent('instance:onInvite') @@ -269,3 +269,7 @@ Citizen.CreateThread(function() end end) + +Citizen.CreateThread(function() + TriggerEvent('instance:loaded') +end) \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 958bcb50..c461a425 100644 --- a/server/main.lua +++ b/server/main.lua @@ -23,6 +23,7 @@ function CreateInstance(type, player, data) data = data } + TriggerEvent('instance:onCreate', Instances[player]) TriggerClientEvent('instance:onCreate', player, Instances[player]) TriggerClientEvent('instance:onInstancedPlayersData', -1, GetInstancedPlayers()) @@ -39,7 +40,7 @@ function CloseInstance(instance) Instances[instance] = nil TriggerClientEvent('instance:onInstancedPlayersData', -1, GetInstancedPlayers()) - + TriggerEvent('instance:onClose', instance) end end