• GodDisable (a nil value)
    5 replies, posted
Hello, I am trying to create a hook for OnPlayerChangedTeam which would ungod them (in the case they were coming from a staff class which is godded). ply returns a player value however the function fails with the following error: [ERROR] addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:385: attempt to call method 'GodDisable' (a nil value)   1. fn - addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:385    2. Call - addons/ulib/lua/ulib/shared/hook.lua:109     3. Function - gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:78      4. unknown - lua/includes/modules/usermessage.lua:87 Code: hook.Add("OnPlayerChangedTeam", "removeGod", function(ply, oldTeam, newTeam)         ply:GodDisable() end
Going off the stack trace this is being called client side, which Player/GodDisable is not. It looks like "OnPlayerChangedTeam" is shared, so just wrap this in a server block, or put it in a server side only file.
Navigate to addons/darkrpmodification/lua/darkrp_config/settings.lua Make sure babygod is disabled. PlayerSpawn = function(ply) ply:GodEnable() end, PlayerDeath = function(ply) ply:GodDisable() end you don't need to use the hook because you can just do a custom check for things like this DarkRP jobs need three ulx groups to have one job.
How would I change it once they change class though? I want to create an admin class that gets god mode when they change to it and looses it once they change to another job
Don't have an admin-on-duty job, make your admins play on the server they are staff on. Read the linked thread though.
Read the links I provided; you don't need to do anything except set a value in the job table of jobs.lua for the job you want to have god mode.
Sorry, you need to Log In to post a reply to this thread.