[Tutorial] How To Make Score System With Timers
#20

Quote:
Originally Posted by -•♥♠♦♣-•Arshavin•-♥♠♦♣•-
Посмотреть сообщение
How To Make Score System With Timers
Introduction
I'll be showing u today how to make score system with timers....
first we will be defining them then set the timers then set the publics to gain score and killtimers after u gain it
so it doesnt just reapet all over and i'll be making if player already have score < 2 ,, 2= number of timers scores u did so if u loged out and loged in just doesnt repeat

The Start

so first lets define our timers
pawn Код:
new ScoreTimer1[MAX_PLAYERS];
new ScoreTimer2[MAX_PLAYERS];
Scripting

so now we will set the timers

pawn Код:
ScoreTimer1[playerid] = SetTimerEx("AddScore1", 60000, true, "i", playerid);
ScoreTimer2[playerid] = SetTimerEx("AddScore2", 120000, true, "i", playerid);
60000 = 1minute with milliseconds cuase timers aint 1 = second so
1000 = 1second 1minute = 60000 1hr = 3,600,000 so if u want it by hours just multiply 3,600,000 x [number of hrs] to get u the number of hrs u want in milliseconds same with minutes 60000 x [number of mins]

So after ur done with setting ur timers now lets go to the part of gaining score and killtimer after the timer pass
and gaining the score ...

pawn Код:
forward AddScore1(playerid);
public AddScore1(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
    new string[200];
    format(string, sizeof(string, "~g~U're now level 1 Congratz");
    GameTextForPlayer(playerid, string, 1000, 0);
    KillTimer(ScoreTimer1[playerid]);
    if(GetPlayerScore(playerid) < 2)
    {
               KillTimer(ScoreTimer1[playerid]);
    }
    return 1;
}
pawn Код:
forward AddScore2(playerid);
public AddScore2(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
    new string[200];
    format(string, sizeof(string, "~g~U're now level 2 Congratz");
    GameTextForPlayer(playerid, string, 1000, 0);
    KillTimer(ScoreTimer2[playerid]);
    if(GetPlayerScore(playerid) < 2) // Change the < 2 of the numbers to the number of scoretimers u got
    {
               KillTimer(ScoreTimer2[playerid]);
    }
    return 1;
}
Summary


In This Tutorial we used timers and game texts

1st (First): we defined them

2nd (Second): we set the timers

3rd (Third): we set the publics for gaining scores and killtimers


Conclusion


Now if u stayed 1minute online on server u gonna be lvl 1 means +1 then 2minutes lvl2 +1 more so score2
So i was showing u ex: for 2 scoretimers u can just keep adding to the number of lvls u want
I Hope it was good tutorial if you got any errors i'll be glad to help post ur errors in a comment please


Ok Thanks For Reading my tutorial i hope it was usefull for ur server Don't worry if u got any errors just post it down here and i'll help
PS: If something u didnt understand in my explanation just post it and i'll explain it Bai!

Arshavin, Thanks bb..
PHP код:
C:\Users\Elvis VJR\Desktop\FreeRoams Los Santos GangWar!\gamemodes\GW.pwn(2093) : error 001expected token")"but found ","
C:\Users\Elvis VJR\Desktop\FreeRoams Los Santos GangWar!\gamemodes\GW.pwn(2108) : error 001expected token")"but found ","
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors

Reply


Messages In This Thread
How To Make Score System With Timers - by -•♥♠♦♣-•Arshavin•-♥♠♦♣•- - 06.01.2011, 22:51
AW: How To Make Score System With Timers - by NuggaN_ - 08.01.2011, 05:39
Re: How To Make Score System With Timers - by Souvlaki - 08.01.2011, 05:43
Re: How To Make Score System With Timers - by admantis - 08.01.2011, 05:45
Re: How To Make Score System With Timers - by Lorenc_ - 08.01.2011, 06:03
AW: How To Make Score System With Timers - by NuggaN_ - 08.01.2011, 06:21
Re: How To Make Score System With Timers - by admantis - 08.01.2011, 06:23
Re: How To Make Score System With Timers - by Lorenc_ - 08.01.2011, 06:40
Re: AW: How To Make Score System With Timers - by Tee - 08.01.2011, 06:41
Re: How To Make Score System With Timers - by ToPhrESH - 08.01.2011, 06:47
Re: How To Make Score System With Timers - by -•♥♠♦♣-•Arshavin•-♥♠♦♣•- - 08.01.2011, 06:51
Re: AW: How To Make Score System With Timers - by -•♥♠♦♣-•Arshavin•-♥♠♦♣•- - 08.01.2011, 06:55
Re: How To Make Score System With Timers - by Stefand - 13.11.2011, 09:54
Re: How To Make Score System With Timers - by Kostas' - 13.11.2011, 10:10
Re: How To Make Score System With Timers - by Janek17 - 21.12.2011, 18:52
Re: How To Make Score System With Timers - by LaGrande - 29.04.2012, 21:18
Re: How To Make Score System With Timers - by ReD_HunTeR - 01.12.2012, 19:27
Re: How To Make Score System With Timers - by xMCx - 05.12.2012, 14:29
Re: How To Make Score System With Timers - by --LooD-- - 05.12.2012, 20:58
Re: How To Make Score System With Timers - by UserName31 - 01.02.2014, 14:58

Forum Jump:


Users browsing this thread: 1 Guest(s)