SCRIPT ERROR: @d-phone0.5/server/server.lua:64: attempt to index a nil value (global ‘ESX’)
I use the “d-phone” script for my server and get this error everytime i press f1 in game. It shows “you have to have a phone to open it” and i dont know what to do. I copied the sql in my database, tried to create an item manually and give it to me, but i dont know the “name” of it exaktly.
Maybe its an easy solution, maybe not. Help would be nice!
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local item = xPlayer.getInventoryItem("phone")
if item.count >= 1 then
TriggerClientEvent("d-phone:client:hasphone", _source)
end
Here you got the first 25 Lines of Server.lua. Should be fine, i think, like you said
ESX = nil
local backgroundurl
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
MySQL.ready(function()
Wait(1000)
MySQL.Async.fetchAll('SELECT * FROM jobs ', {}, function(result)
for _,v in pairs(result) do
MySQL.Async.fetchAll("SELECT * FROM `phone_messages` WHERE `receiver` = @receiver OR `sender` = @receiver" , {["@receiver"] = v.label}, function(messages)
if messages[1] ~= nil then
MySQL.Async.execute("DELETE FROM `phone_messages` WHERE `receiver` = @receiver" , {
["@receiver"] = v.label,
})
MySQL.Async.execute("DELETE FROM `phone_messages` WHERE `sender` = @receiver" , {
["@receiver"] = v.label,
})
end
end)
end
end)
end)
Access denied for command add_principal.
es_extended: invalid item “d-phone” ignored!
Access denied for command add_principal.
es_extended: invalid item “d-phone” ignored!
thats the new error: (the phone works, but i cant take it away and the apps do not work correktly)
SCRIPT ERROR in reference call: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Tanks, the errors are away now. But theres one last left and most of the Phone included Apps seems not to work
SCRIPT ERROR in reference call: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index