Hey guys, trying to do when player creates character he gets phone in his inventory, but getting error.
RegisterNUICallback('register', function(data, cb)
local reason = ""
myIdentity = data
for theData, value in pairs(myIdentity) do
if theData == "firstname" or theData == "lastname" then
reason = verifyName(value)
if reason ~= "" then
break
end
elseif theData == "dateofbirth" then
if value == "invalid" then
reason = "Netinkama gimimo data"
break
end
elseif theData == "height" then
local height = tonumber(value)
if height then
if height > 200 or height < 140 then
reason = "Netinkamas ūgis"
break
end
else
reason = "Netinkamas ūgis"
break
end
end
end
if reason == "" then
TriggerServerEvent('esx_identity:setIdentity', data, myIdentifiers)
EnableGui(false)
Citizen.Wait(500)
TriggerEvent('esx_skin:openSaveableMenu', myIdentifiers.id)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.addInventoryItem('phone', 1)
else
ESX.ShowNotification(reason)
end
end)