• Adding custom hook help
    4 replies, posted
So i use the Free DarkRP leveling system [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=270216963"]http://steamcommunity.com/sharedfiles/filedetails/?id=270216963[/URL] What I am trying to do is create a hook or function that when a player goes afk they wont earn exp. I dont know much of lua but I think I might be on the right track. If the hook is right do i need to define one for if they leave afk? Also where would i need to add the hook at? Thanks for any help provided! [code]local function StartAFKOnPlayer(ply) LevelSystemConfiguration.Timertime = 300 end hook.Add("PlayerInitialSpawn", "StartAFKOnPlayer", StartAFKOnPlayer)[/code] [editline]23rd July 2014[/editline] Or would it be more along the lines of this. I have no idea what the difference is between the two. [code]if ply.DarkRPVars.AFK then LevelSystemConfiguration.Timertime = 0 else LevelSystemConfiguration.Timetime = 300 end end[/code] Sorry about that, Ive never used facepunch before. Im kinda new to all this
This tag ----> ["CODE][/CODE"](without ") can make magic. Seriously can you use the code tags or lua tags?
[QUOTE=Icejjfish;45478947]This tag ----> ["CODE][/CODE"](without ") can make magic. Seriously can you use the code tags or lua tags?[/QUOTE] Just as a note for the future, you can put unparsed tags with [noparse][noparse][/noparse]. [noparse][code][/code][/noparse]
[QUOTE=code_gs;45478967]Just as a note for the future, you can put unparsed tags with [noparse][noparse][/noparse]. [noparse][code][/code][/noparse][/QUOTE] [code] if ply.DarkRPVars.AFK then LevelSystemConfiguration.Timertime = 0 else LevelSystemConfiguration.Timetime = 300 end end [/code] [code] local function StartAFKOnPlayer(ply) LevelSystemConfiguration.Timertime = 300 end hook.Add("PlayerInitialSpawn", "StartAFKOnPlayer", StartAFKOnPlayer) [/code]
Any idea if im on the right track? And sorry about the code box. I didnt know how to do that. I will note it for future reference :)
Sorry, you need to Log In to post a reply to this thread.