• team.TotalFrags() is a userdata ?
    2 replies, posted
[I]So here is the error I'm getting :[/I] [CODE][ERROR] gamemodes/tdm/gamemode/init.lua:18: attempt to compare userdata with number 1. fn - gamemodes/tdm/gamemode/init.lua:18 2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183 [/CODE] [I] And here is my init.lua[/I] [CODE] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include( "shared.lua" ) CreateConVar( "tdm_max_score", 30, FCVAR_SERVER_CAN_EXECUTE ) TDMMaxScore = GetConVar( "tdm_max_score" ) function CheckRUFrags() if ( !GAMEMODE:InRound() ) then return end if team.TotalFrags (TEAM_RU) >= TDMMaxScore then GM.RoundEndWithResult(TEAM_RU, team.GetName(TEAM_RU) .. "s wins!") end end hook.Add( "Think", "CheckRUFrags", CheckRUFrags ) function CheckUSFrags() if ( !GAMEMODE:InRound() ) then return end if team.TotalFrags (TEAM_US) >= TDMMaxScore then GM.RoundEndWithResult(TEAM_US, team.GetName(TEAM_US) .. "s wins!") end end hook.Add( "Think", "CheckUSFrags", CheckUSFrags ) [/CODE] Isn't team.TotalFrags() supposed to return an integer?
I think the problem is that you didn't :GetInt() on the convar when you defined TDMMaxScore.
Fixed it!
Sorry, you need to Log In to post a reply to this thread.