-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fc435d
commit be7700b
Showing
9 changed files
with
446 additions
and
546 deletions.
There are no files selected for viewing
74 changes: 37 additions & 37 deletions
74
server-data/resources/[wasabi]/wasabi_fishing/bridge/esx/client.lua
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 |
---|---|---|
@@ -1,68 +1,68 @@ | ||
if GetResourceState("es_extended") ~= "started" then | ||
return | ||
return | ||
end | ||
ESX = exports["es_extended"]:getSharedObject() | ||
Framework, PlayerLoaded, PlayerData = "esx", nil, {} | ||
|
||
RegisterNetEvent("esx:playerLoaded", function(xPlayer) | ||
PlayerData = xPlayer | ||
PlayerLoaded = true | ||
PlayerData = xPlayer | ||
PlayerLoaded = true | ||
end) | ||
|
||
RegisterNetEvent("esx:onPlayerSpawn", function() | ||
TriggerEvent("wasabi_fishing:onPlayerSpawn") | ||
TriggerEvent("wasabi_fishing:onPlayerSpawn") | ||
end) | ||
|
||
AddEventHandler("esx:onPlayerDeath", function(data) | ||
TriggerEvent("wasabi_fishing:onPlayerDeath") | ||
TriggerEvent("wasabi_fishing:onPlayerDeath") | ||
end) | ||
|
||
RegisterNetEvent("esx:onPlayerLogout", function() | ||
table.wipe(PlayerData) | ||
PlayerLoaded = false | ||
table.wipe(PlayerData) | ||
PlayerLoaded = false | ||
end) | ||
|
||
RegisterNetEvent("esx:setJob", function(job) | ||
PlayerData.job = job | ||
PlayerData.job = job | ||
end) | ||
|
||
AddEventHandler("onResourceStart", function(resourceName) | ||
if GetCurrentResourceName() ~= resourceName or not ESX.PlayerLoaded then | ||
return | ||
end | ||
PlayerData = ESX.GetPlayerData() | ||
PlayerLoaded = true | ||
if GetCurrentResourceName() ~= resourceName or not ESX.PlayerLoaded then | ||
return | ||
end | ||
PlayerData = ESX.GetPlayerData() | ||
PlayerLoaded = true | ||
end) | ||
|
||
AddEventHandler("esx:setPlayerData", function(key, value) | ||
if GetInvokingResource() ~= "es_extended" then | ||
return | ||
end | ||
PlayerData[key] = value | ||
if GetInvokingResource() ~= "es_extended" then | ||
return | ||
end | ||
PlayerData[key] = value | ||
end) | ||
|
||
function HasGroup(filter) | ||
local type = type(filter) | ||
local type = type(filter) | ||
|
||
if type == "string" then | ||
if PlayerData.job.name == filter then | ||
return PlayerData.job.name, PlayerData.job.grade | ||
end | ||
else | ||
local tabletype = table.type(filter) | ||
if type == "string" then | ||
if PlayerData.job.name == filter then | ||
return PlayerData.job.name, PlayerData.job.grade | ||
end | ||
else | ||
local tabletype = table.type(filter) | ||
|
||
if tabletype == "hash" then | ||
local grade = filter[PlayerData.job.name] | ||
if tabletype == "hash" then | ||
local grade = filter[PlayerData.job.name] | ||
|
||
if grade and grade <= PlayerData.job.grade then | ||
return PlayerData.job.name, PlayerData.job.grade | ||
end | ||
elseif tabletype == "array" then | ||
for i = 1, #filter do | ||
if PlayerData.job.name == filter[i] then | ||
return PlayerData.job.name, PlayerData.job.grade | ||
end | ||
end | ||
end | ||
end | ||
if grade and grade <= PlayerData.job.grade then | ||
return PlayerData.job.name, PlayerData.job.grade | ||
end | ||
elseif tabletype == "array" then | ||
for i = 1, #filter do | ||
if PlayerData.job.name == filter[i] then | ||
return PlayerData.job.name, PlayerData.job.grade | ||
end | ||
end | ||
end | ||
end | ||
end |
102 changes: 51 additions & 51 deletions
102
server-data/resources/[wasabi]/wasabi_fishing/bridge/esx/server.lua
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 |
---|---|---|
@@ -1,91 +1,91 @@ | ||
if GetResourceState("es_extended") ~= "started" then | ||
return | ||
return | ||
end | ||
ESX = exports["es_extended"]:getSharedObject() | ||
Framework = "esx" | ||
|
||
function GetPlayer(source) | ||
return ESX.GetPlayerFromId(source) | ||
return ESX.GetPlayerFromId(source) | ||
end | ||
|
||
function KickPlayer(source, reason) | ||
local player = GetPlayer(source) | ||
return player.kick(reason) | ||
local player = GetPlayer(source) | ||
return player.kick(reason) | ||
end | ||
|
||
function HasGroup(source, filter) | ||
local player = GetPlayer(source) | ||
local type = type(filter) | ||
local player = GetPlayer(source) | ||
local type = type(filter) | ||
|
||
if type == "string" then | ||
if player.job.name == filter then | ||
return player.job.name, player.job.grade | ||
end | ||
else | ||
local tabletype = table.type(filter) | ||
if type == "string" then | ||
if player.job.name == filter then | ||
return player.job.name, player.job.grade | ||
end | ||
else | ||
local tabletype = table.type(filter) | ||
|
||
if tabletype == "hash" then | ||
local grade = filter[player.job.name] | ||
if tabletype == "hash" then | ||
local grade = filter[player.job.name] | ||
|
||
if grade and grade <= player.job.grade then | ||
return player.job.name, player.job.grade | ||
end | ||
elseif tabletype == "array" then | ||
for i = 1, #filter do | ||
if player.job.name == filter[i] then | ||
return player.job.name, player.job.grade | ||
end | ||
end | ||
end | ||
end | ||
if grade and grade <= player.job.grade then | ||
return player.job.name, player.job.grade | ||
end | ||
elseif tabletype == "array" then | ||
for i = 1, #filter do | ||
if player.job.name == filter[i] then | ||
return player.job.name, player.job.grade | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
function GetIdentifier(source) | ||
local xPlayer = ESX.GetPlayerFromId(source) | ||
return xPlayer.identifier | ||
local xPlayer = ESX.GetPlayerFromId(source) | ||
return xPlayer.identifier | ||
end | ||
|
||
function GetName(source) | ||
local xPlayer = ESX.GetPlayerFromId(source) | ||
return xPlayer.getName() | ||
local xPlayer = ESX.GetPlayerFromId(source) | ||
return xPlayer.getName() | ||
end | ||
|
||
function RegisterUsableItem(item, cb) | ||
ESX.RegisterUsableItem(item, cb) | ||
ESX.RegisterUsableItem(item, cb) | ||
end | ||
|
||
function HasItem(source, item) | ||
local player = GetPlayer(source) | ||
local item = player.getInventoryItem(item) | ||
if item ~= nil then | ||
return item.count | ||
else | ||
return 0 | ||
end | ||
local player = GetPlayer(source) | ||
local item = player.getInventoryItem(item) | ||
if item ~= nil then | ||
return item.count | ||
else | ||
return 0 | ||
end | ||
end | ||
|
||
function AddItem(source, item, count, slot, metadata) | ||
local player = GetPlayer(source) | ||
return player.addInventoryItem(item, count, metadata, slot) | ||
local player = GetPlayer(source) | ||
return player.addInventoryItem(item, count, metadata, slot) | ||
end | ||
|
||
function RemoveItem(source, item, count, slot, metadata) | ||
local player = GetPlayer(source) | ||
player.removeInventoryItem(item, count, metadata, slot) | ||
local player = GetPlayer(source) | ||
player.removeInventoryItem(item, count, metadata, slot) | ||
end | ||
|
||
function AddMoney(source, type, amount) | ||
if type == "cash" then | ||
type = "money" | ||
end | ||
local player = GetPlayer(source) | ||
player.addAccountMoney(type, amount) | ||
if type == "cash" then | ||
type = "money" | ||
end | ||
local player = GetPlayer(source) | ||
player.addAccountMoney(type, amount) | ||
end | ||
|
||
function RemoveMoney(source, type, amount) | ||
if type == "cash" then | ||
type = "money" | ||
end | ||
local player = GetPlayer(source) | ||
player.removeAccountMoney(type, amount) | ||
if type == "cash" then | ||
type = "money" | ||
end | ||
local player = GetPlayer(source) | ||
player.removeAccountMoney(type, amount) | ||
end |
122 changes: 59 additions & 63 deletions
122
server-data/resources/[wasabi]/wasabi_fishing/bridge/qb/client.lua
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 |
---|---|---|
@@ -1,91 +1,87 @@ | ||
if GetResourceState("qb-core") ~= "started" then | ||
return | ||
return | ||
end | ||
QBCore = exports["qb-core"]:GetCoreObject() | ||
Framework, PlayerLoaded, PlayerData = "qb", nil, {} | ||
|
||
AddStateBagChangeHandler("isLoggedIn", "", function(_bagName, _key, value, _reserved, _replicated) | ||
if value then | ||
PlayerData = QBCore.Functions.GetPlayerData() | ||
else | ||
table.wipe(PlayerData) | ||
end | ||
PlayerLoaded = value | ||
if value then | ||
PlayerData = QBCore.Functions.GetPlayerData() | ||
else | ||
table.wipe(PlayerData) | ||
end | ||
PlayerLoaded = value | ||
end) | ||
|
||
AddEventHandler("onResourceStart", function(resourceName) | ||
if GetCurrentResourceName() ~= resourceName or not LocalPlayer.state.isLoggedIn then | ||
return | ||
end | ||
PlayerData = QBCore.Functions.GetPlayerData() | ||
PlayerLoaded = true | ||
if GetCurrentResourceName() ~= resourceName or not LocalPlayer.state.isLoggedIn then | ||
return | ||
end | ||
PlayerData = QBCore.Functions.GetPlayerData() | ||
PlayerLoaded = true | ||
end) | ||
|
||
AddEventHandler("gameEventTriggered", function(event, data) | ||
if event ~= "CEventNetworkEntityDamage" then | ||
return | ||
end | ||
local victim, victimDied = data[1], data[4] | ||
if not IsPedAPlayer(victim) then | ||
return | ||
end | ||
local player = PlayerId() | ||
if | ||
victimDied | ||
and NetworkGetPlayerIndexFromPed(victim) == player | ||
and (IsPedDeadOrDying(victim, true) or IsPedFatallyInjured(victim)) | ||
then | ||
TriggerEvent("wasabi_fishing:onPlayerDeath") | ||
end | ||
if event ~= "CEventNetworkEntityDamage" then | ||
return | ||
end | ||
local victim, victimDied = data[1], data[4] | ||
if not IsPedAPlayer(victim) then | ||
return | ||
end | ||
local player = PlayerId() | ||
if victimDied and NetworkGetPlayerIndexFromPed(victim) == player and (IsPedDeadOrDying(victim, true) or IsPedFatallyInjured(victim)) then | ||
TriggerEvent("wasabi_fishing:onPlayerDeath") | ||
end | ||
end) | ||
|
||
RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function() | ||
TriggerEvent("wasabi_fishing:onPlayerSpawn") | ||
TriggerEvent("wasabi_fishing:onPlayerSpawn") | ||
end) | ||
|
||
RegisterNetEvent("QBCore:Player:SetPlayerData", function(newPlayerData) | ||
if source ~= "" and GetInvokingResource() ~= "qb-core" then | ||
return | ||
end | ||
PlayerData = newPlayerData | ||
if source ~= "" and GetInvokingResource() ~= "qb-core" then | ||
return | ||
end | ||
PlayerData = newPlayerData | ||
end) | ||
|
||
function HasGroup(filter) | ||
local groups = { "job", "gang" } | ||
local type = type(filter) | ||
local groups = { "job", "gang" } | ||
local type = type(filter) | ||
|
||
if type == "string" then | ||
for i = 1, #groups do | ||
local data = PlayerData[groups[i]] | ||
if type == "string" then | ||
for i = 1, #groups do | ||
local data = PlayerData[groups[i]] | ||
|
||
if data.name == filter then | ||
return data.name, data.grade.level | ||
end | ||
end | ||
else | ||
local tabletype = table.type(filter) | ||
if data.name == filter then | ||
return data.name, data.grade.level | ||
end | ||
end | ||
else | ||
local tabletype = table.type(filter) | ||
|
||
if tabletype == "hash" then | ||
for i = 1, #groups do | ||
local data = PlayerData[groups[i]] | ||
local grade = filter[data.name] | ||
if tabletype == "hash" then | ||
for i = 1, #groups do | ||
local data = PlayerData[groups[i]] | ||
local grade = filter[data.name] | ||
|
||
if grade and grade <= data.grade.level then | ||
return data.name, data.grade.level | ||
end | ||
end | ||
elseif tabletype == "array" then | ||
for i = 1, #filter do | ||
local group = filter[i] | ||
if grade and grade <= data.grade.level then | ||
return data.name, data.grade.level | ||
end | ||
end | ||
elseif tabletype == "array" then | ||
for i = 1, #filter do | ||
local group = filter[i] | ||
|
||
for j = 1, #groups do | ||
local data = PlayerData[groups[j]] | ||
for j = 1, #groups do | ||
local data = PlayerData[groups[j]] | ||
|
||
if data.name == group then | ||
return data.name, data.grade.level | ||
end | ||
end | ||
end | ||
end | ||
end | ||
if data.name == group then | ||
return data.name, data.grade.level | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.