Jump to content
  • 0

timer scor


shaun

Question

3 answers to this question

Recommended Posts

La OnGameModeInit()

public OnGameModeInit()
{
    SetTimer( "ScoreUpdate", 60000, 1 );
}
Iar pe urma faci o functie noua, numita ScoreUpdate
forward ScoreUpdate();
public ScoreUpdate()
{
    for( new i; i < MAX_PLAYERS; i++ )
    {
          if( IsPlayerConnected( i )
          {
                 SetPlayerScore( i, GetPlayerScore( i ) + 1 );
          }
     }
}
Asta ar trebui sa functioneze. Acum, binenteles poti face mai 'complex', care sa dea la fix si 0 secunde score + 1 ... dar e mai complicat, pentru ca trebuie sa faci timer`ul in fiecare secunda sa verifice daca e si 0 secunde ... Daca vrei, pot sa`ti fac si aia :)
forward ScoreUpdate();
public ScoreUpdate()
{
    new hh, mm, ss;
    gettime( hh, mm, ss );
    
    if( ss == 0 )
    {
        foreach (Player,i)
    	{
        	SetPlayerScore( i, GetPlayerScore( i ) + 1 );
	}
    }
    return 1;
}
Si acum trebuie sa modifici Timer`ul pe care ti l`am dat mai sus:
 SetTimer( "ScoreUpdate", 1000, 1 );

Asta verifica in fiecare secunda daca e secunda 0 al unui minut si daca da, atunci face update la score.

Sper sa functioneze :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.