-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
138 lines (124 loc) · 5.02 KB
/
Copy pathclient.lua
File metadata and controls
138 lines (124 loc) · 5.02 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
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
local haToccato = false
CreateThread(function()
for k,v in pairs(Config.Rental) do
local blip = AddBlipForCoord(v.marker.x, v.marker.y, 130)
SetBlipSprite(blip, Blip.sprite)
SetBlipDisplay(blip, 4)
SetBlipColour(blip, Blip.colour)
SetBlipAsShortRange(blip, true)
SetBlipScale(blip, Blip.scale)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName(Blip.name)
EndTextCommandSetBlipName(blip)
if Config.gridsystem then
TriggerEvent('gridsystem:registerMarker', {
name = 'rental'..k,
pos = v.marker,
size = Marker.size,
scale = Marker.size,
color = Marker.color,
type = Marker.type,
control = Marker.control,
msg = Lang.msg,
action = function()
Config.Type(v.spawn)
lib.showContext('rental')
end
})
else
CreateThread(function()
while true do
local asp = Marker.refreshTime
local distanza = #(GetEntityCoords(cache.ped) - v.marker)
if distanza < Marker.drawDistance then
asp = 0
DrawMarker(Marker.type, v.marker.x, v.marker.y, v.marker.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Marker.size.x, Marker.size.y, Marker.size.z, Marker.color.r, Marker.color.g, Marker.color.b, 140, false, false, 2, nil, nil, false)
end
if distanza <= Marker.interactDistance then
lib.showTextUI(Lang.msg, Marker.TextUI)
haToccato = true
if IsControlJustPressed(0, Marker.interactKey) then
Config.Type(v.spawn)
lib.showContext('rental')
end
else
if haToccato then
lib.hideTextUI()
haToccato = false
end
end
Wait(asp)
end
end)
end
end
end)
local preso = false
NewVeh = function(spawn, args)
if not Config.TimeRental then
lib.callback('checkMoneyRental', false, function(a)
if a ~= false then
lib.requestModel(args.type)
local veh = CreateVehicle(args.type, spawn.x, spawn.y, spawn.z, spawn.w, true, true)
SetPedIntoVehicle(cache.ped, veh, -1)
if Config.hudFuel then
SetVehicleFuelLevel(veh, 100.0)
end
if Config.ox_target then
local options = {
{
name = 'dep',
icon = Marker.depositIcon,
label = Lang.depositMsg,
distance = Marker.depositDistance,
onSelect = function(data)
DeleteEntity(data.entity)
local pos = 'dddsfssdf'
TriggerServerEvent('partial:refund', args.refund, pos)
end
}
}
exports.ox_target:addLocalEntity(veh, options)
end
else
Config.Notify(Config.noMoney)
end
end, args.price)
else
if not preso then
local input = lib.inputDialog(Lang.time, {
{type = 'number', description = Lang.minutes, icon = 'money-bill', required = true},
})
if not input then return end
if not input[1] then return end
local time = tonumber(input[1])
if time <= 0 then Config.Notify(Lang.less) return end
if time > Config.MaxMinutes then Config.Notify(Lang.max) return end
local price = time * Config.PriceMinute
local total = price + args.price
lib.callback('checkMoneyRental', false, function(a)
if a ~= false then
lib.requestModel(args.type)
local veh = CreateVehicle(args.type, spawn.x, spawn.y, spawn.z, spawn.w, true, true)
SetPedIntoVehicle(cache.ped, veh, -1)
if Config.hudFuel then
SetVehicleFuelLevel(veh, 100.0)
end
local pp = 'gsfkfak'
local time2 = time * 60
TriggerServerEvent('time:rental', pp, time2, veh)
preso = true
end
end, total)
else
Config.Notify(Lang.already)
end
end
end
RegisterNetEvent('delete:vehicle:rental', function(veh, pass)
if pass == 'fafsafaf' then
preso = false
DeleteEntity(veh)
Config.Notify(Lang.finished)
end
end)