-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.lua
More file actions
34 lines (28 loc) · 1.04 KB
/
Copy pathserver.lua
File metadata and controls
34 lines (28 loc) · 1.04 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
lib.versionCheck('vanishdevs/vanish_starterpack')
---@param playerId (number) The ID of the player to check
---@return boolean
local function CheckIfClaimed(playerId)
local player = GetPlayer(playerId)
local playerIdentifier = GetIdentifier(player)
local result = CheckClaimed(playerIdentifier)
if result then
return result == 1
end
return true
end
lib.callback.register('vanishdev:server:CheckIfClaimed', function(source)
return CheckIfClaimed(source)
end)
RegisterNetEvent('vanishdev:server:ClaimStarterPack', function()
local source = source
local player = GetPlayer(source)
local playerIdentifier = GetIdentifier(player)
local playerPed = GetPlayerPed(source)
local playerCoords = GetEntityCoords(playerPed)
local hasClaimed = CheckIfClaimed(source)
if player and not hasClaimed and #(playerCoords - Config.Coords) < 5.0 then
GiveInventoryItems(player, Config.Items)
UpdateClaimed(playerIdentifier)
ShowNotification(locale('recieved'), source)
end
end)