GmodCentral




Custom functions


  • What are custom functions?



    Custom functions are our way of allowing developers and server owners alike to integrate more things to sell in your webstore. For example lets say you want to give your donors 2X their current money when they donate, so someone who donates and has $20,000 would then have $40,000. While we do not directly support that it can easily be done with a custom function.
  • How can I add custom functions?


    To add a custom function go into your GmodCentral addon and navigate to ../addons/GmodCentral/lua/autorun/server/customFunctions.lua and then simply create a function. The variable ply is a constant and will always be used to pass the player who donated. There are examples in the file. Lets take a look at the example:

    function CustomChat(ply, str)
    ply:ChatPrint(str);
    end

    Okay so with that function above if you wanted to used it to say "Hello World!" in chat every time someone donated, you would add an item of type "Custom Function" to the package you wish to use this on inside your GmodCentral Dashboard. In the text field put ' CustomChat(ply, "Hello World!") '.