-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServeri.lua
154 lines (131 loc) · 4.67 KB
/
Serveri.lua
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
function RandomItem()
return Config.commonitem[math.random(#Config.commonitem)]
end
function RandomItem2()
return Config.rareitem[math.random(#Config.rareitem)]
end
if Config.Framework == 'esx' then
ESX = exports["es_extended"]:getSharedObject()
ESX.RegisterUsableItem('oxygenmask', function(source)
local Pelaaja = ESX.GetPlayerFromId(source)
Pelaaja.removeInventoryItem('oxygenmask', 1)
TriggerClientEvent('Bubsimaski', source)
end)
RegisterServerEvent('Bubsipalkkio')
AddEventHandler('Bubsipalkkio', function(Bubsikey)
local nimi = GetPlayerName(source)
if Bubsikey == 'Bubsinkeyjuttusysteemi' then
local chanssi = math.random(1, 100)
math.randomseed(GetGameTimer())
local Pelaaja = ESX.GetPlayerFromId(source)
if chanssi > 1 and chanssi < 30 then
TriggerClientEvent('Bubsinotify', source, 5000, Config.locales.eimitaa, Config.types.error)
elseif chanssi > 30 and chanssi < 99 then
Pelaaja.addInventoryItem(RandomItem(), 1)
Dclogit(Config.vari, Config.locales.otsikko, nimi.. Config.locales.loys.. "**" ..RandomItem().. "**")
elseif chanssi == 100 then
Pelaaja.addInventoryItem(RandomItem2(), 1)
Dclogit(Config.vari, Config.locales.otsikko, nimi.. Config.locales.loys.. "**" ..RandomItem2().. "**")
end
else
DropPlayer(source, Config.locales.cheatter)
Dclogit(Config.vari, Config.locales.otsikko, nimi.. Config.locales.huijjaa)
end
end)
RegisterServerEvent('Bubsikmaski')
AddEventHandler('Bubsikmaski', function(Bubsikey)
if Bubsikey == 'Bubsinkeyjuttusysteemi' then
local Pelaaja = ESX.GetPlayerFromId(source)
Pelaaja.addInventoryItem('emptyoxygenmask', 1)
else
DropPlayer(source, Config.locales.cheatter)
end
end)
RegisterServerEvent('Bubsitankki')
AddEventHandler('Bubsitankki', function(Bubsikey)
if Bubsikey == 'Bubsinkeyjuttusysteemi' then
local Pelaaja = ESX.GetPlayerFromId(source)
Pelaaja.removeInventoryItem('emptyoxygenmask', 1)
Pelaaja.addInventoryItem('oxygenmask', 1)
else
DropPlayer(source, Config.locales.cheatter)
end
end)
ESX.RegisterServerCallback('Bubsioxygentank', function(source, cb)
local Pelaaja = ESX.GetPlayerFromId(source)
local itemi = Pelaaja.getInventoryItem('emptyoxygenmask').count
if itemi > 0 then
cb(true)
else
cb(false)
end
end)
end
if Config.Framework == 'qb' then
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.CreateUseableItem('oxygenmask', function(source)
local Pelaaja = QBCore.Functions.GetPlayer(source)
Pelaaja.Functions.RemoveItem('oxygenmask', 1)
TriggerClientEvent('Bubsimaski', source)
end)
RegisterServerEvent('Bubsipalkkio')
AddEventHandler('Bubsipalkkio', function(Bubsikey)
if Bubsikey == 'Bubsinkeyjuttusysteemi' then
local chanssi = math.random(1, 100)
local Pelaaja = QBCore.Functions.GetPlayer(source)
if chanssi > 1 and chanssi < 30 then
TriggerClientEvent('Bubsinotify', source, 5000, Config.locales.eimitaa, Config.types.error)
elseif chanssi > 30 and chanssi < 99 then
Pelaaja.Functions.AddItem(RandomItem(), 1)
elseif chanssi == 100 then
Pelaaja.Functions.AddItem(RandomItem2(), 1)
end
else
DropPlayer(source, Config.locales.cheatter)
end
end)
RegisterServerEvent('Bubsikmaski')
AddEventHandler('Bubsikmaski', function(Bubsikey)
if Bubsikey == 'Bubsinkeyjuttusysteemi' then
local Pelaaja = QBCore.Functions.GetPlayer(source)
Pelaaja.Functions.AddItem('emptyoxygenmask', 1)
else
DropPlayer(source, Config.locales.cheatter)
end
end)
RegisterServerEvent('Bubsitankki')
AddEventHandler('Bubsitankki', function(Bubsikey)
if Bubsikey == 'Bubsinkeyjuttusysteemi' then
local Pelaaja = QBCore.Functions.GetPlayer(source)
Pelaaja.Functions.RemoveItem('emptyoxygenmask', 1)
Pelaaja.Functions.AddItem('oxygenmask', 1)
else
DropPlayer(source, Config.locales.cheatter)
end
end)
QBCore.Functions.CreateCallback('Bubsioxygentank', function(source, cb)
local Pelaaja = QBCore.Functions.GetPlayer(source)
local itemi = Pelaaja.Functions.GetItemByName('emptyoxygenmask')
if itemi then
cb(true)
else
cb(false)
end
end)
end
function Dclogit(color, name, message, dc, footer)
if Config.uselogs then
local footer = 'Bubsi - '..os.date("%d/%m/%Y - %X")
local embed = {
{
["color"] = color,
["title"] = "**".. name .."**",
["description"] = message,
["footer"] = {
["text"] = footer,
},
}
}
PerformHttpRequest(Config.Webhook, function(err, text, headers) end, 'POST', json.encode({username = Config.BotinNimi, embeds = embed}), { ['Content-Type'] = 'application/json' })
end
end