-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient.lua
84 lines (74 loc) · 2.36 KB
/
client.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
-- This resource was made by plesalex100#7387
-- Please respect it, don't repost it without my permission
-- This Resource started from: https://codepen.io/AdrianSandu/pen/MyBQYz
local open = false
local function drawHint(text)
SetTextComponentFormat("STRING")
AddTextComponentString(text)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end
Citizen.CreateThread(function()
if Cfg.blipsEnabled then
for k,v in ipairs(Cfg.Pacanele)do
local blip = AddBlipForCoord(v.x, v.y, v.z)
SetBlipSprite(blip, 436)
SetBlipDisplay(blip, 4)
SetBlipScale(blip, 1.0)
SetBlipColour(blip, 49)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Pacanele")
EndTextCommandSetBlipName(blip)
end
end
end)
Citizen.CreateThread(function ()
SetNuiFocus(false, false)
open = false
local wTime = 500
local x = 1
while true do
Citizen.Wait(wTime)
langaAparat = false
for i=1, #Cfg.Pacanele, 1 do
if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), Cfg.Pacanele[i].x, Cfg.Pacanele[i].y, Cfg.Pacanele[i].z, true) < 2 then
x = i
wTime = 0
langaAparat = true
drawHint('Press ~INPUT_PICKUP~ to test your luck at slot machine')
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), Cfg.Pacanele[x].x, Cfg.Pacanele[x].y, Cfg.Pacanele[x].z, true) > 4 then
wTime = 500
end
end
end
end)
RegisterNetEvent("ples-slots:bagXLei")
AddEventHandler("ples-slots:bagXLei", function(lei)
SetNuiFocus(true, true)
open = true
SendNUIMessage({
showPacanele = "open",
coinAmount = tonumber(lei)
})
end)
RegisterNUICallback('exitWith', function(data, cb)
cb('ok')
SetNuiFocus(false, false)
open = false
TriggerServerEvent("ples-slots:aiCastigat", data.coinAmount)
end)
Citizen.CreateThread(function ()
while true do
Citizen.Wait(1)
if open then
DisableControlAction(0, 1, true) -- LookLeftRight
DisableControlAction(0, 2, true) -- LookUpDown
DisableControlAction(0, 24, true) -- Attack
DisablePlayerFiring(GetPlayerPed(-1), true) -- Disable weapon firing
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
elseif IsControlJustReleased(0, 38) and langaAparat then
TriggerServerEvent('ples-slots:catiLeiBagi')
end
end
end)