Hi all, i try to put this in my customCheck :
[CODE]customCheck = function(ply) return ply:GetUTime() > 10800 end,
CustomCheckFailMsg = "Il faut 3 heures de jeu !",[/CODE]
But, when i open the F4 it says
[CODE]
[ERROR] addons/darkrpmodification-master/lua/darkrp_customthings/jobs.lua:439: attempt to compare number with string
1. customCheck - addons/darkrpmodification-master/lua/darkrp_customthings/jobs.lua:439
2. canGetJob - gamemodes/darkrp/gamemode/modules/f4menu/cl_menuitem.lua:95
3. setDarkRPItem - gamemodes/darkrp/gamemode/modules/f4menu/cl_menuitem.lua:117
4. fillData - gamemodes/darkrp/gamemode/modules/f4menu/cl_jobstab.lua:357
5. Init - gamemodes/darkrp/gamemode/modules/f4menu/cl_jobstab.lua:326
6. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153
7. F4MenuTabs - gamemodes/darkrp/gamemode/modules/f4menu/cl_init.lua:59
8. generateTabs - gamemodes/darkrp/gamemode/modules/f4menu/cl_frame.lua:176
9. openF4Menu - gamemodes/darkrp/gamemode/modules/f4menu/cl_init.lua:12
10. Call - gamemodes/darkrp/gamemode/modules/f4menu/cl_init.lua:24
11. unknown - gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:46
[/CODE]
I don't know what i do but, if someone can help me ? (this happen when i place THIS customCheck.)
Convert ply:GetUTime() to a number with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/tonumber]Global.tonumber[/url]
Why is ply:GetUTime() a string to begin with?
[QUOTE=MattJeanes;46693783]Why is ply:GetUTime() a string to begin with?[/QUOTE]
It's not
[lua]
function meta:GetUTime()
return self:GetNWInt( "TotalUTime" )
end
[/lua]
[QUOTE=Blasteh;46694188]It's not
[lua]
function meta:GetUTime()
return self:GetNWInt( "TotalUTime" )
end
[/lua][/QUOTE]
Yes it is:
[quote]
[17:02] [GCompute GLua STEAM_0:0:58178275 (<color=33,91,51>Flex) -> Server]
[17:02] -- 7 B
[17:02] "3124127"
[/quote]
Apposed to printing a number, it wouldn't have quotation marks around it
EDIT: Honestly I'd string.FormatTime GetUTime() and save it to a varable then do variable.h < 3 (no heart intended)
Sorry, you need to Log In to post a reply to this thread.