forked from Simnation/Main
34 lines
859 B
Lua
34 lines
859 B
Lua
![]() |
---@class iHackedAtm
|
||
|
---@field model string
|
||
|
---@field coords vector3
|
||
|
---@field time integer
|
||
|
|
||
|
--[[ require ]]
|
||
|
|
||
|
local Inventory = require 'modules.inventory.server'
|
||
|
|
||
|
--[[ state ]]
|
||
|
|
||
|
Hack = {}
|
||
|
|
||
|
--[[ events ]]
|
||
|
|
||
|
RegisterNetEvent(_e('server:hacking:onAtmHackCompleted'), function(model, coords)
|
||
|
local hacker = source
|
||
|
server.SetAtmHacked(model, coords, hacker)
|
||
|
TriggerClientEvent(_e('client:hacking:onAtmHacked'), -1, model, coords)
|
||
|
|
||
|
TriggerClientEvent(_e('client:hacking:onHackCompleted'), hacker, model, coords)
|
||
|
end)
|
||
|
|
||
|
lib.callback.register(_e('server:hacking:collectAtmCashPile'), function(source)
|
||
|
local itemName = Config.Hack.reward.name
|
||
|
local itemCount = math.random(Config.Hack.reward.min, Config.Hack.reward.max)
|
||
|
|
||
|
Inventory.GiveItem(source, itemName, itemCount)
|
||
|
|
||
|
return true
|
||
|
end)
|
||
|
|
||
|
--[[ Others ]]
|