SA-MP Forums Archive
Team Scores--> FORWARD PROBLEM! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Team Scores--> FORWARD PROBLEM! (/showthread.php?tid=112523)



Team Scores--> FORWARD PROBLEM! - patchkinson - 08.12.2009

Hello, i've got a team score system in my gamemode, but how do i make it that, 6 minutes after the gamemode starts, it checks for every player's score and sums them. and for example 2 players in team alpha and 2 players in team beta, 1 player in beta gets 2 points score and other one gets 1, in alpha one has 4 and another has 6, that means alpha team has more points, how do i make the game, after 6 minutes Freeze everyone, sum the scores of team members, and team with most score wins the game, and a GameTextForPlayer appears saying "(TEAM NAME) Won This Game", in team name it has to be the team name, if its alpha team appear team alpha
how i make that
please thanks



Re: Team Scores - patchkinson - 08.12.2009

i dont know if its possible but....



Re: Team Scores - dice7 - 08.12.2009

https://sampwiki.blast.hk/wiki/SetTimer

pawn Код:
new
    Team1 = 0,
    Team2 = 0;
for(new id = 0; id < MAX_PLAYERS; id++)
{
    if(!IsPlayerConnected(id)) continue;
   
    if(gTeam[id] == TEAM_ALPHA) //or whatever you use
    {
      Team1 = Team1 + GetPlayerScore(id);
    }
    else
    {
      Team2 = Team2 + GetPlayerScore(id);
    }
}

if(Team1 > Team2)
{
  GameTextForPlayer(playerid, "Team1 won", 3000, 4);
}
else if(Team 1 < Team2)
{
  GameTextForPlayer(playerid, "Team2 won", 3000, 4);
}
else
{
  GameTextForPlayer(playerid, "Tie", 3000, 4);
}



Re: Team Scores - patchkinson - 08.12.2009

Thanks a lot
you da best!
1 question, the time in timers is in MS?


Re: Team Scores - Balon - 08.12.2009

Quote:

the time in timers is in MS?

Yes.


Re: Team Scores - Donny_k - 08.12.2009

Quote:
Originally Posted by patchkinson
Thanks a lot
you da best!
1 question, the time in timers is in MS?
Quote:

interval Inverval in milliseconds.

Had you looked on the Wiki (linked above) you would of seen this.


Re: Team Scores - patchkinson - 08.12.2009

Quote:
Originally Posted by Donny
Quote:
Originally Posted by patchkinson
Thanks a lot
you da best!
1 question, the time in timers is in MS?
Quote:

interval Inverval in milliseconds.

Had you looked on the Wiki (linked above) you would of seen this.
i didnt look cose i have timers on other script of mine, just confused
but now i have a problem
pawn Код:
#if defined war
forward endgame();
#endif
gamemodeinit:
pawn Код:
#define war
    #if defined war
    SetTimer("endgame",360000,false);
    #endif
and then
pawn Код:
#if defined war
public endgame(playerid,funcname[], interval, repeating)
{
    TogglePlayerControllable(playerid,0);
    return 1;
}
#endif
THEN ERROR!!!
warning 235: public function lacks forward declaration (symbol "endgame")
But the thing is forwarded :-/


Re: Team Scores--> FORWARD PROBLEM! - Joe Staff - 08.12.2009

place your #define war at the very top.


Re: Team Scores--> FORWARD PROBLEM! - patchkinson - 08.12.2009

it is :-/


Re: Team Scores--> FORWARD PROBLEM! - Malice - 08.12.2009

That's strange that it gives you that warning. Either way you can always remove the #if from forward. When I forget to remove a forward for a non-existent function the compiler never says anything. So AFAIK leaving forward in unconditionally seems harmless.