Jump to content

Database [ALTER TABLE]


Recommended Posts

Hello _Marco_,

since we are not a SQL support forums you can search on other domains if you want a solution based on SQL only. What you are asking though can be achieved inside of Lua.

I am going to assume that you habe full access to the resource and want to modify it to provide a /listcommands feature. I am also going to assume that every command that you are interested in is registered during resource start-up. In that case you can make use of meta.xml load order to hook the addCommandHandler function before it is executed and fetch all of these commands into an internal list. For example...


  <script src="hook.lua" type="client" />
  <script src="client1.lua" type="client" />
  <script src="clientn.lua" type="client" />


local _addCommandHandler = addCommandHandler;

local cmdlist = {};

function addCommandHandler(cmdname, ...)
    cmdlist[cmdname] = true;
    return _addCommandHandler(cmdname, ...);

        outputChatBox("--- cmdlist ---", player);
        for m,n in pairs(cmdlist) do
            outputChatBox("* " .. m);

Can you follow me this far? Now you have a cmdlist variable which contains a table that contains unique command names as table keys that can be retrieved using pairs for-loop. The next step would be to push all the data to a SQL database at resource stop.

Good luck! ?

Edited by The_GTA
  • 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...