• Help with returning a value for derma
    4 replies, posted
In darkrp im trying to return how long a player has been arrested for and idk what i should use for this can anyone assist me with this
[URL="http://wiki.darkrp.com/index.php/Main_Page"]DarkRP[/URL] wiki has a lot of great information. It doesn't look like the wiki has a hook or function for this but you could make your little workaround: [code] local arrested = {} local function getArrestTime(ply) local time = CurTime() - arrested[ply:SteamID()][2] if time > arrested[ply:SteamID()][1] then return 0 else return time end end hook.Add("playerArrested", "arrestTime", function(criminal, time, arrestor) arrested[criminal:SteamID()] = {time, CurTime()} end) [/code] This code has to be ran serverside. Also, you should post this in developer discussion next time. It is untested because I don't have DarkRP installed BUT it seems like it will work. If it throws any errors, post them here.
[QUOTE=Cornfinder;49888647][URL="http://wiki.darkrp.com/index.php/Main_Page"]DarkRP[/URL] wiki has a lot of great information. It doesn't look like the wiki has a hook or function for this but you could make your little workaround: [code] local arrested = {} local function getArrestTime(ply) local time = CurTime() - arrested[ply:SteamID()][2] if time > arrested[ply:SteamID()][1] then return 0 else return time end end hook.Add("playerArrested", "arrestTime", function(criminal, time, arrestor) arrested[criminal:SteamID()] = {time, CurTime()} end) [/code] This code has to be ran serverside. Also, you should post this in developer discussion next time. It is untested because I don't have DarkRP installed BUT it seems like it will work. If it throws any errors, post them here.[/QUOTE] Hey dude thanks !!! [editline]8th March 2016[/editline] [QUOTE=Cornfinder;49888647][URL="http://wiki.darkrp.com/index.php/Main_Page"]DarkRP[/URL] wiki has a lot of great information. It doesn't look like the wiki has a hook or function for this but you could make your little workaround: [code] local arrested = {} local function getArrestTime(ply) local time = CurTime() - arrested[ply:SteamID()][2] if time > arrested[ply:SteamID()][1] then return 0 else return time end end hook.Add("playerArrested", "arrestTime", function(criminal, time, arrestor) arrested[criminal:SteamID()] = {time, CurTime()} end) [/code] This code has to be ran serverside. Also, you should post this in developer discussion next time. It is untested because I don't have DarkRP installed BUT it seems like it will work. If it throws any errors, post them here.[/QUOTE] how do i return this for text if i used like ply:ChatPrint()
[QUOTE=defyReality;49889678]Hey dude thanks !!! [editline]8th March 2016[/editline] how do i return this for text if i used like ply:ChatPrint()[/QUOTE] [URL="http://wiki.garrysmod.com/page/Global/tostring"]tostring[/URL]?
[QUOTE=JasonMan34;49892054][URL="http://wiki.garrysmod.com/page/Global/tostring"]tostring[/URL]?[/QUOTE] ---- snip nvm i got it
Sorry, you need to Log In to post a reply to this thread.