-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathserver.lua
More file actions
69 lines (54 loc) · 1.97 KB
/
Copy pathserver.lua
File metadata and controls
69 lines (54 loc) · 1.97 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
60
61
62
63
64
65
66
67
68
69
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('medSystem:print')
AddEventHandler('medSystem:print', function(req, pulse, area, blood, x, y, z, bleeding)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
Wait(100)
local name = getIdentity(_source)
local xPlayers = ESX.GetPlayers()
for i=1, #xPlayers, 1 do
TriggerClientEvent('medSystem:near', xPlayers[i] ,x ,y ,z , pulse, blood, name.firstname, name.lastname, area, bleeding)
end
end)
RegisterCommand('med', function(source, args)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
for k,v in pairs(Config.job) do
if v.ambulance and xPlayer.job.name == 'ambulance' then
if args[1] ~= nil then
TriggerClientEvent('medSystem:send', args[1], source)
else
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Incorrect player ID!")
end
elseif v.police and xPlayer.job.name == 'police' then
if args[1] ~= nil then
TriggerClientEvent('medSystem:send', args[1], source)
else
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Incorrect player ID!")
end
elseif v.mechanic and xPlayer.job.name == 'mechanic' then
if args[1] ~= nil then
TriggerClientEvent('medSystem:send', args[1], source)
else
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Incorrect player ID!")
end
else
xPlayer.showNotification('Your job is not Whitelisted!', true , true, 30)
end
end
end, false)
function getIdentity(source)
local xPlayer = ESX.GetPlayerFromId(source)
local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {['@identifier'] = xPlayer.identifier})
if result[1] ~= nil then
local identity = result[1]
return {
identifier = identity['identifier'],
firstname = identity['firstname'],
lastname = identity['lastname'],
}
else
return nil
end
end