How to make a timer..
#1

Hello everyone, I am willing to make a timer which will be shown if a player join the race, and how to make that to be shown only to the people who are in the race itself?

It shall be something like that:

the race will start\n3, the race will start\n2..etc.

Thanks in advance.
Reply
#2

this on top of script
pawn Код:
new subscribeds;
new racers[MAX_PLAYERS]=-1;
The timer
forward RaceTimer(numero);
pawn Код:
public RaceTimer(numero){
    new str[50];
    new Float:pX,Float:pY,Float:pZ;
    if(numero>0){
            for(new i = 0; i < subscribeds; i++){
                format(str, sizeof (str), "~r~[][] %d[][]", numero);
                if (IsPlayerConnected(racers[i])){ // the racers is a variable that check if the player is in a race. thats up to you change.
                    GameTextForPlayer(racers[i], str, 1200, 3); // the racers is a variable that check if the player is in a race. thats up to you change.
                    if(numero<6){
                        GetPlayerPos(i,pX,pY,pZ);
                        PlayerPlaySound(i,1056,pX,pY,pZ);
                    }
                }
            }
            numero--;
            SetTimerEx("CD",1000,0,"i",numero);
    }
    else{
          for(new i = 0; i < subscribeds; i++){
                if (IsPlayerConnected(racers[i])){ // the racers is a variable that check if the player is in a race. thats up to you change.
                    GameTextForPlayer(racers[i], "~g~[][][]  GO!! [][][]!!!", 1200, 3); // the racers is a variable that check if the player is in a race. thats up to you change.
                    PlayerPlaySound(i,1057,pX,pY,pZ);
                }
            }
    }
    return 1;
}
And where the player joins the race add SEE BELOW
pawn Код:
racers[subscribeds]=playerid;
Good luck
Reply
#3

Quote:
Originally Posted by JamesH
Посмотреть сообщение
this on top of script
pawn Код:
new subscribeds;
new racers[MAX_PLAYERS]=-1;
The timer
forward RaceTimer(numero);
pawn Код:
public RaceTimer(numero){
    new str[50];
    new Float:pX,Float:pY,Float:pZ;
    if(numero>0){
            for(new i = 0; i < subscribeds; i++){
                format(str, sizeof (str), "~r~[][] %d[][]", numero);
                if (IsPlayerConnected(racers[i])){ // the racers is a variable that check if the player is in a race. thats up to you change.
                    GameTextForPlayer(racers[i], str, 1200, 3); // the racers is a variable that check if the player is in a race. thats up to you change.
                    if(numero<6){
                        GetPlayerPos(i,pX,pY,pZ);
                        PlayerPlaySound(i,1056,pX,pY,pZ);
                    }
                }
            }
            numero--;
            SetTimerEx("CD",1000,0,"i",numero);
    }
    else{
          for(new i = 0; i < subscribeds; i++){
                if (IsPlayerConnected(racers[i])){ // the racers is a variable that check if the player is in a race. thats up to you change.
                    GameTextForPlayer(racers[i], "~g~[][][]  GO!! [][][]!!!", 1200, 3); // the racers is a variable that check if the player is in a race. thats up to you change.
                    PlayerPlaySound(i,1057,pX,pY,pZ);
                }
            }
    }
    return 1;
}
And where the player joins the race add SEE BELOW
pawn Код:
racers[subscribeds]=playerid;
Good luck
Wow, would never figure that out by myself lol...
Thanks alot.
Reply
#4

Sure, update here if you need anything else.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)