Team Scores--> FORWARD PROBLEM!
#1

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
Reply
#2

i dont know if its possible but....
Reply
#3

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);
}
Reply
#4

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

Quote:

the time in timers is in MS?

Yes.
Reply
#6

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.
Reply
#7

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 :-/
Reply
#8

place your #define war at the very top.
Reply
#9

it is :-/
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)