• Counting Grenade Kills
    3 replies, posted
I'm working on a death match game mode. I wrote a kill counter, and it works, but it's not counting kills from grenades. What I'm trying to do is set it up so that the function recognizes that the grenade is the inflicter and to get the thrower of the grenade to set that Ent for SetNetworkedInt. I might not be stringing these functions together properly. :/ Either way I'm stumped. I wrote this snippet as part of the kill counter function, and it's yelling at me. [LUA] if !killer:IsPlayer( ) then inflictor.GetOwner():SetNetworkedInt( "kills", inflictor.GetOwner():GetNetworkedInt( "kills" ) + 1 ) inflictor.GetOwner():SetNetworkedInt( "killstreak", inflictor.GetOwner():GetNetworkedInt( "killstreak" ) + 1 ) end [/LUA] Here's the whole function: [LUA] function KillCount( victim, killer, inflictor ) victim:SetNetworkedInt( "killstreak", 0 ) if killer:IsPlayer( ) then killer:SetNetworkedInt( "kills", killer:GetNetworkedInt( "kills" ) + 1 ) killer:SetNetworkedInt( "killstreak", killer:GetNetworkedInt( "killstreak" ) + 1 ) end if !killer:IsPlayer( ) then inflictor.GetOwner():SetNetworkedInt( "kills", inflictor.GetOwner():GetNetworkedInt( "kills" ) + 1 ) inflictor.GetOwner():SetNetworkedInt( "killstreak", inflictor.GetOwner():GetNetworkedInt( "killstreak" ) + 1 ) end if ( killer:Nick() == victim:Nick() ) or ( inflictor.GetOwner():Nick() == victim:Nick() )then killer:SetNetworkedInt( "kills", killer:GetNetworkedInt( "kills" ) - 1 ) end end [/LUA] And here's the error, on line 8 of the whole function. [LUA] bad argument #1 to 'GetOwner' (Entity expected, got no value)[/LUA] [editline]25th December 2012[/editline] Figured it out. It's supposed to be [LUA]inflictor:GetOwner():SetNetworkedInt()[/LUA] Was missing a : between inflictor and GetOwner.
[QUOTE=wranders;38969733] I wrote a kill counter, and it works [/QUOTE]
[QUOTE=timpo204;38971411][/QUOTE] Okay, I guess half-works would have been more accurate.
[Deleted for being an idiot.]
Sorry, you need to Log In to post a reply to this thread.