Jump to content

[Help] Problem with Access denied @ 'loadstring'


Recommended Posts

Guys I'm really stuck and going crazy.Please I need urgent help.I'm adding vehicle upgrades to a panel.
All the upgrades are in the panel. When I press the add button I get this error and warning:

WARNING:Resources\VehPanel\server.lua:25:Access denied @ 'loadstring'

ERROR:Resources\VehPanel\server.lua:25:attempt to call a nil value

Please someone help me.I will be very appreciative of this.

serverside codes are here:

allowedFunctions = { ["addVehicleUpgrade"]=true, ["removeVehicleUpgrade"]=true, ["fixVehicle"]=true,["setVehicleColor"]=true }


function callClientFunction(client, funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for key, value in next, arg do
            if (type(value) == "number") then arg[key] = tostring(value) end
        end
    end
    -- If the clientside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element
    triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {}))
end
function callServerFunction(funcname, ...)
    if not allowedFunctions[funcname] then
        -- Protect server from abuse
        outputServerLog( "SECURITY: " .. tostring(getPlayerName(client)) .. " tried to use function " .. tostring(funcname) )
        return
    end

    local arg = { ... }
    if (arg[1]) then
        for key, value in next, arg do arg[key] = tonumber(value) or value end
    end
    loadstring("return "..funcname)()(unpack(arg))
end
addEvent("onClientCallsServerFunction", true)
addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction)

 

Link to comment
  • Moderators
3 hours ago, Bishop_G said:

Please someone help me.I will be very appreciative of this.

It is a permission issue.

https://wiki.multitheftauto.com/wiki/Server_Commands#aclrequest

First verify if the meta.xml has any acl request listed in it's meta.xml

/aclrequest list <resourceName> all

 

And if loadstring is listed, grand permission.

/aclrequest allow <resourceName> all

 

If not listed, add it to the meta.xml of the resource:

    <aclrequest>
        <right name="function.loadstring" access="true" />
    </aclrequest>

See example: https://wiki.multitheftauto.com/wiki/Meta.xml

Run:

/refreshall

 

And try the aclrequest commands again.

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...