Lua Assistance needed! Gamemode only declaring player winner, not team
3 replies, posted
I'm having some issues again and i've tried everything i can think of, i'm new to Lua but having a stong go at fretta, here's my problem.
[B]What's meant to happen:[/B]
Round ends after 10 mins OR the team has accumilated 100+ kills
At the end of each round winning team is displayd (only player is shown at the moment..)
at the end of all 3 rounds, the winning team OVERALL is displayed with a welldone etc, then the gamemode voting begins..
Here's what i have so far [B]INIT.LUA:[/B]
[code]
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
//Counts round wins.
GM.RoundWins = {}
function GM:OnRoundEnd(t,result)
GAMEMODE.RoundWins[t] = GAMEMODE.RoundWins[t] + 1
end
// Called when the round ends
function GM:OnRoundEnd( num )
for k,v in pairs( team.GetPlayers( TEAM_RESISTANCE ),( TEAM_COMBINE ) ) do
v:SetFrags( 0 ) // Reset their frags for next round
end
end
// This is called every second to see if we can end the round
function GM:CheckRoundEnd()
if ( !GAMEMODE:InRound() ) then return end
for k,v in pairs( team.GetPlayers( TEAM_RESISTANCE ) ) do
if v:Frags() >= 50 then
GAMEMODE:RoundEndWithResult( v )
end
end
for k,v in pairs( team.GetPlayers( TEAM_COMBINE ) ) do
if v:Frags() >= 50 then
GAMEMODE:RoundEndWithResult( v )
end
end
end
GM.RoundEndWithResult(1, team.GetName(1) .. " winsssssssssssssssssss!")
[/code]
I'm really stuck now guys, please help! :)
Replace the first instace of [I]GAMEMODE:RoundEndWithResult( v )[/I] with [I]GAMEMODE:RoundEndWithResult( TEAM_RESISTANCE )[/I], and the second instance with [I]GAMEMODE:RoundEndWithResult( TEAM_COMBINE )[/I].
I'm not exactly sure if this was the right way to do it, but try it out.
Replace
GAMEMODE:RoundEndWithResult( v )
with
GAMEMODE:RoundEndWithResult( v:Team() )
Thankyou so much guys! all's working smooth and i've been able to remove so much old code!
Sorry, you need to Log In to post a reply to this thread.