Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

[Ajuda] SetTimer

$
0
0
olá, estou com o seguinte problema,
Criei um timer para ser iniciado quando o player pegar o primeiro checkpoint, porem o timer não esta sendo setado individualmente, ele seta e fica para todos, os players que logam seguem o timer, como faço para que ele seja setado individualmente para cada player que passar no checkpoint ?

Code:

new rMinute[MAX_PLAYERS] = 0;
new rSec[MAX_PLAYERS] = 0;
new RaceTimer[MAX_PLAYERS] = 0;
____________________________________________
public OnPlayerConnect(playerid)
        CorridaInfo[2] = CreatePlayerTextDraw(playerid,521.000000, 422.000000, "");
        PlayerTextDrawBackgroundColor(playerid,CorridaInfo[2], 255);
        PlayerTextDrawFont(playerid,CorridaInfo[2], 2);
        PlayerTextDrawLetterSize(playerid,CorridaInfo[2], 0.390000, 1.200000);
        PlayerTextDrawColor(playerid,CorridaInfo[2], -65281);
        PlayerTextDrawSetOutline(playerid,CorridaInfo[2], 1);
        PlayerTextDrawSetProportional(playerid,CorridaInfo[2], 1);
        PlayerTextDrawUseBox(playerid,CorridaInfo[2], 1);
        PlayerTextDrawBoxColor(playerid,CorridaInfo[2], 136);
        PlayerTextDrawTextSize(playerid,CorridaInfo[2], 640.000000, 0.000000);
____________________________________________
public OnPlayerEnterRaceCheckpoint(playerid)
        if(CheckP[playerid] == 1)
            RaceTimer[playerid] = SetTimerEx("RaceTimeer",1000,true,"i",playerid);
        PlayerTextDrawShow(playerid,CorridaInfo[2]);
------------------------------------------------------------
        if(CheckP[playerid] == 43)
        KillTimer(RaceTimer[playerid]);
____________________________________________
forward RaceTimeer(playerid);
public RaceTimeer(playerid)
{
        new string[218];
        rSec[playerid]++;
        if(rSec[playerid] == 60)
        {
                rMinute[playerid]++;
                rSec[playerid] = 0;
        }
        if(rSec[playerid] < 10)
        format(string,sizeof(string),"Tempo: ~w~0%d:0%d",rMinute[playerid],rSec[playerid]);
        else
        format(string,sizeof(string),"Tempo: ~w~0%d:%d",rMinute[playerid],rSec[playerid]);
        PlayerTextDrawSetString(playerid,CorridaInfo[2],string);
}
____________________________________________


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>