Knowledgebase » Developers » Things that your script should NOT contain

Here are some things that will instantly get your script denied

  1. Backdoors
    • Nothing should give you or your friends an unfair advantage over other players, or do things that would be considered malicious.
    • What are you, a child?
  2. Non-unique file names
    • All lua folders get mounted into a single lua folder. Your addon doesn't run on its own little island and you shouldn't behave that way. Having something named lua/autorun/init.lua will instantly get your script denied.
  3. Putting all your stuff in _G
    • You should be putting most of your stuff in your own table, and your own table should be unique enough.
    • Only exception to this rule are enumerations
    • If you have a function or variable that is NOT local and simply named something similar to SpawnNPC, your script will be denied
  4. Usermessages
    • There is literally no reason why you should be using them over this
  5. Bad networking practices
    • This includes things like setting DataTable variables or sending net messages too often (for example, in a think hook)
    • Using tostring() on numbers and sending the string instead of simply sending a number.
    • Setting DataTable variables that are never used on the client
    • Sending data to the client which is never used.
  6. Exploitable networking practices
    • net.WriteEntity(LocalPlayer()) is extremely dumb. You should be using the second argument of your net.Receive function to find out who sent the message
    • Assume that anyone can send a net message using the lua_run_cl command at any time.
    • Most of your important calculations should always be done on the server, not on the client
  7. Redundant code
    • If you're copy/pasting something, you should probably use a function or a loop.
    • If you're doing things like something1=2; something2=4; perhaps you should use a loop for that.
  8. "Changing collision rules in a callback is likely to cause crashes!"
    • Do not do anything that would cause this error to appear in console.
    • Things that may cause this error include:
    • Removing an entity in a touch or collision hook
    • Changing physobject properties in a touch or collision hook
  9. Using content that you do not own/have rights to
    • These are things such as models/images/code.
    • If you do not own the rights to these, using them will have your script instantly denied!
    • If you use content that requires acknowledgement to the developer/creator, then provide it in your script description.
  10. Using SendLua/BroadcastLua
    • Properly network. That's all. No special cases.
  11. No scaling
    • Lay out your UI in a manner that will work with any resolution.
    • Items such as fonts and materials should also be considered.
  12. Using hooks in a way that prevents other hooks from running.
    • This includes not using hook.Add without calling the "Old Function"
    • Whenever a hook returns a value, other hooks may not be called.
    • Again, your addons are not running in their own little island. Be considerate of what other addons may want.
    • Instead of returning a value if something doesn't meet your conditions, return nothing!
    • Example of what NOT to do:
-- THIS IS VERY BAD
hook.Add( "PlayerUse", "some_unique_name", function( ply, ent )
    if ply:IsAdmin() then
        return true
    else
        return false
    end
end )


Last updated June 4, 2017 15:08 by ARitz Cracker