Also, I really wouldn’t bother using the class, if you wanna restrict just base it off the players skin or identifier through a function and a table.
If you wanna add this into a proximity try this
Client
RegisterNetEvent('proxUnrack')
AddEventHandler('proxUnrack', function(id, name)
local ID = PlayerId()
local plyID = GetPlayerFromServerId(id)
if plyID == ID then
TriggerEvent('chatMessage', "", {255, 255, 255}, " ^*".. name .. " Unracks ^1M4 ".." ")
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(ID)), GetEntityCoords(GetPlayerPed(plyID)), true) < 49.999 then
TriggerEvent('chatMessage', "", {255, 255, 255}, " ^*".. name .. " Unracks ^1M4 ".." ")
end
end)
RegisterNetEvent('proxRack')
AddEventHandler('proxRack', function(id, name)
local ID = PlayerId()
local plyID = GetPlayerFromServerId(id)
if plyID == ID then
TriggerEvent('chatMessage', "", {255, 255, 255}, " ^*".. name .. " Racks ^1M4 ".." ")
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(ID)), GetEntityCoords(GetPlayerPed(plyID)), true) < 49.999 then
TriggerEvent('chatMessage', "", {255, 255, 255}, " ^*".. name .. " Racks ^1M4 ".." ")
end
end)
Server
RegisterCommand('unrack', function(source, args, user)
local name = GetPlayerName(source)
TriggerClientEvent("proxUnrack", -1, source, name)
end, false)
RegisterCommand('rack', function(source, args, user)
local name = GetPlayerName(source)
TriggerClientEvent("proxRack", -1, source, name)
end, false)
Untested but just an idea.