-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.lua
More file actions
59 lines (46 loc) · 1.58 KB
/
server.lua
File metadata and controls
59 lines (46 loc) · 1.58 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
51
52
53
54
55
56
57
58
59
local VorpCore = {}
TriggerEvent("getCore", function(core)
VorpCore = core
end)
local VORPInv = {}
VORPInv = exports.vorp_inventory:vorp_inventoryApi()
RegisterServerEvent("legacy_medic:reviveplayer")
AddEventHandler("legacy_medic:reviveplayer", function()
print("triggered")
local _source = source
local Character = VorpCore.getUser(_source).getUsedCharacter
local money = Character.money
if money >= Config.doctors.amount then
Character.removeCurrency(0, Config.doctors.amount) -- Remove money 1000 | 0 = money, 1 = gold, 2 = rol
VorpCore.NotifyRightTip(_source,Config.Language.revived..Config.doctors.amount,4000)
TriggerClientEvent('legacy_medic:revive', _source)
else
VorpCore.NotifyRightTip(_source,Config.Language.notenough..Config.doctors.amount,4000)
end
end)
RegisterServerEvent("legacy_medic:getjob")
AddEventHandler("legacy_medic:getjob", function()
local _source = source
local docs = 0
for z, m in ipairs(GetPlayers()) do
local User = VorpCore.getUser(m)
local used = User.getUsedCharacter
if CheckTable(Config.doctors.job, used.job) then
docs = docs + 1
end
end
if docs == 0 then
TriggerClientEvent('legacy_medic:findjob', _source)
end
if docs >= 1 then
VorpCore.NotifyRightTip(_source,Config.Language.doctoractive,4000)
end
end)
function CheckTable(table, element)
for k, v in pairs(table) do
if v == element then
return true
end
end
return false
end