• TTT small issue
    3 replies, posted
[QUOTE] [ERROR] lua/autorun/ttt points.lua:22: attempt to call method 'GetRole' (a nil value) 1. NotifyPlayer - lua/autorun/ttt points.lua:22 2. fn - lua/autorun/ttt points.lua:39 3. unknown - addons/ulib/lua/ulib/shared/hook.lua:183 4. TakeDamageInfo - [C]:-1 5. unknown - gamemodes/terrortown/gamemode/player.lua:832[/QUOTE] [B]LINE 22[/B] [lua] local num = RolePoints[killer:GetRole()][ply:GetRole()][/lua]
Did you check to see if ply and killer were valid before that line, in the function?
[QUOTE=Pandaman09;39466106]Did you check to see if ply and killer were valid before that line, in the function?[/QUOTE] Sorry i'm not good with lua here's the code [lua]function NotifyPlayer(ply, killer) local num = RolePoints[killer:GetRole()][ply:GetRole()][/lua] also have this [code][ERROR] .../terrortown/entities/weapons/weapon_ttt_knife/shared.lua:267: attempt to call global 'ValidEntity' (a nil value) 1. unknown - .../terrortown/entities/weapons/weapon_ttt_knife/shared.lua:267[/code] [lua]function SWEP:OnRemove() if CLIENT and IsValid(self.Owner) and self.Owner == LocalPlayer() and self.Owner:Alive() then // 267 RunConsoleCommand("lastinv") end end[/lua]
put one line above: local num = RolePoints[killer:GetRole()][ply:GetRole()] put: if not IsValid(ply) or IsValid(killer) then return end this will say if the person that was killed or if the killer is not valid them exit.
Sorry, you need to Log In to post a reply to this thread.