-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
56 lines (50 loc) · 1.75 KB
/
client.lua
File metadata and controls
56 lines (50 loc) · 1.75 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
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterCommand('claimstarterpack', function(source, args)
ESX.TriggerServerCallback('claim_starterpack:checkClaim', function(claimed)
if claimed == 1 then
if Config.useMythicNotify then
TriggerEvent('mythic_notify:client:SendAlert', { type = 'inform', text = Config.Lang['already_claimed'] })
else
ESX.ShowNotification(Config.Lang['already_claimed'])
end
else
TriggerEvent('claim_starterpack:spawnVehicle', Config.vehicle)
end
end)
end)
AddEventHandler('claim_starterpack:spawnVehicle', function(model)
local playerPed = GetPlayerPed(-1)
local coords = GetEntityCoords(playerPed)
local carExist = false
ESX.Game.SpawnVehicle(model, coords, 0.0, function(vehicle) --get vehicle info
if DoesEntityExist(vehicle) then
carExist = true
SetEntityVisible(vehicle, false, false)
SetEntityCollision(vehicle, false)
local newPlate = exports.esx_vehicleshop:GeneratePlate()
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
vehicleProps.plate = newPlate
TriggerServerEvent('claim_starterpack:setVehicle', vehicleProps)
ESX.Game.DeleteVehicle(vehicle)
if Config.useMythicNotify then
TriggerEvent('mythic_notify:client:SendAlert', { type = 'inform', text = Config.Lang['success_claim'] })
else
ESX.ShowNotification(Config.Lang['success_claim'])
end
end
end)
Wait(2000)
if not carExist then
if Config.useMythicNotify then
TriggerEvent('mythic_notify:client:SendAlert', { type = 'inform', text = Config.Lang['not_exists'] })
else
ESX.ShowNotification(Config.Lang['not_exists'])
end
end
end)