Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why is the infection gamemode bugged?
#11
(04-07-2012, 21:45)surtek Wrote: I have found the problem.

Problem:
Code:
getNumSurvivors()
{
    numSurvivors = 0;
    foreach ( player in level.players )
    {
        if ( player.team == "allies" )
            numSurvivors++;
    }
    return numSurvivors;    
}

It counts every players that belongs to the "allies" (team). Each player will add 1 to "numSurvivors". The problem is, that this function doesn't add -1 if a player loses connection or leaves.

How to solve:
Make a check how many players are really left each 2 seconds or something. Than put this amount in "numSurvivors".

I hope this helped you.

No. This isn't true. It checks the number of survivors every time an infected kills a player. Then it does if(survivorCount == 0) -> last survivor died, infected won.
[Image: MaEIQ.png]
Reply

#12
plz some1 fix this Sad
Reply

#13
Meh did someone figure out what was the exact issue? Rendflex and I have been trying to get this to work in MW2 but it never counts down.
Code:
updateTeamScores()
{
    game["teamScores"]["axis"] = getNumInfected();
    setTeamScore( "axis", getNumInfected() );
    game["teamScores"]["allies"] = getNumSurvivors();
    setTeamScore( "allies", getNumSurvivors() );
}


getNumInfected()
{
    numInfected = 0;
    foreach ( player in level.players )
    {
        if ( player.team == "axis" )
            numInfected++;
    }
    return numInfected;    
} //why are you so stupid! You don't even count correctly! (when you leave the counter stays the same)


getNumSurvivors()
{
    numSurvivors = 0;
    foreach ( player in level.players )
    {
        if ( player.team == "allies" )
            numSurvivors++;
    }
    return numSurvivors;    
} //why are you so stupid! You don't even count correctly!(when you leave the counter stays the same)
Problem being updateTeamScores() most likely, it does an update on: onSpawnPlayer(), onPlayerKilled(XXXXXXXXXXXXXXXX), and onPlayerDisconnect() *using a for(;Wink*.
Code:
onPlayerDisconnect()
{
    for(;;)
    {
        level waittill( "disconnected", player );
        
        updateTeamScores();
Any help will be appreciated.
Note: If you suggest putting: level waittill( "disconnected"); on updateTeamScores() don't. It doesn't even work... as it starts the match but you don't get any weapons nor does the counter even initialize.
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Request] no ammo for infected gamemode ExoGamer* 8 5,548 08-15-2013, 18:59
Last Post: Dr3am95
  [Release] ''WAR'' GameMode by Met PL Eekhoorn 52 104,537 03-28-2013, 00:26
Last Post: wattz3
  [News] New Gamemode - Hacker?! ZuNe 2 2,725 02-01-2013, 19:30
Last Post: ZuNe
  [News] am makeing a gamemode pap12322221112 2 2,451 09-30-2012, 17:33
Last Post: OrangePL
  [REQUEST] Random Gamemode NooB_StalkeR 5 3,536 08-19-2012, 22:59
Last Post: NooB_StalkeR
  I'm looking for a plugin that is able to change the current gamemode and map. moosa67 3 2,838 08-14-2012, 19:37
Last Post: JariZ
  Wager maps in custom gamemode projacol 2 2,555 06-23-2012, 14:49
Last Post: projacol
  Help Infected gamemode settings. Andrees 3 5,809 06-03-2012, 16:56
Last Post: Andrees
  [Request] Bugged final killcam fix xcondex 1 2,534 02-19-2012, 12:16
Last Post: Nekochan
Lightbulb Infection edition nofamily 7 5,464 11-29-2011, 20:47
Last Post: _Smile_Man_

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.