What hook can I use for this

Hey guys, I’m trying to check a players time using UTime and displaying a message if their time meets the requirement. However, I don’t know what hook I should run it on. This is what I’m trying to do.


	if LocalPlayer():GetUTimeTotalTime() = 1800 then
	chat.AddText( Color( 60, 60, 60 ), "[", Color( 30 ,90 ,150 ), "gUnlocks", Color( 60, 60, 60 ), "]", Color( 255, 255, 255 ), "You've unlocked the !"
	end

Think hook

What’s the context? When do you want it to check? It looks like it’s unlocking a gun or something, so maybe when they go to try and equip/buy the gun? Just find the right place to do the check so that you aren’t doing it excessively like in a think hook.

Think hook should work.

I want it to display the text when a players total playing time reaches the number above :stuck_out_tongue:
meaning: when GetUTimeTotalTime() = 1800

You can do something like


if LocalPlayer():GetUTimeTotalTime() == 1800 then
	draw.SimpleText("You have been playing for 1800 seconds?","debug",0,0,Color(0,0,0,255),1,1)
end

Not tested, but should work.

Edit: 1800 = 30 mins
Just so you know. (:

[editline]23rd January 2016[/editline]

You can also use this for DarkRP Jobs!
Example:



TEAM_THIEF = DarkRP.createJob("Thief", {
    color = Color(0, 0, 0, 255),
    model = "models/player/arctic.mdl",
    description = [[You are a thief, rob people, lockpick their house and steal their plants and legal printers.]],
    weapons = {"lockpick", "swep_pickpocket"},
    command = "thief",
    max = 2,
    salary = 65,
    admin = 0,
    vote = false,
    hasLicense = false,
    category = "Corrupt Civilians",
    customCheck = function(ply) return ply:GetUTimeTotalTime() >= 3600 end,
    CustomCheckFailMsg = "You must play on the server for " .. (3600 - ply:GetUTimeTotalTime()) .. " more seconds to become a Thief!"
})


That’s actually what I use it for :P. I decided to remove the whole VIP jobs aspect :slight_smile: I’ll try out your suggestion thanks!