Time Countup
#2

pawn Код:
new GameMinutes = 0;
new GameSeconds = 00;
new GameTimer;
new Text:RaceTime;

forward GameTime(playerid);

public OnGameModeInit()
{

    RaceTime = TextDrawCreate(557.000000, 375.000000, "00:00");
    TextDrawAlignment(RaceTime, 2);
    TextDrawBackgroundColor(RaceTime, 255);
    TextDrawFont(RaceTime, 1);
    TextDrawLetterSize(RaceTime, 0.450000, 1.200000);
    TextDrawColor(RaceTime, -1);
    TextDrawSetOutline(RaceTime, 0);
    TextDrawSetProportional(RaceTime, 0);
    TextDrawSetShadow(RaceTime, 1);
   
    return 1;
}

public GameTime(playerid)
{
    if(GameSeconds || GameMinutes)
    {
        GameSeconds++;
        if(GameSeconds >= 59)
        {
            GameMinutes++;
            GameSeconds=00;
        }
        new TimeString[256];
        format(TimeString,sizeof(TimeString),"%d:%d",GameMinutes,GameSeconds);
        GameSeconds ++;
        if(GameSeconds == 59)
        {
           GameMinutes ++;
           GameSeconds = 0;
        }
        TextDrawSetString(RaceTime, TimeString); // DONT NEED Text:RaceTime here. Just RaceTime.
    }

    return 1;
}

public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, RaceTime); // NO NEED FOR TEXT
    return 1;
}

public OnGameModeInit()
{
     GameTimer = SetTimer("GameTime",1000,1);
     return 1;
}
Should work
Reply


Messages In This Thread
Time Countup - by sameer419 - 17.01.2012, 19:01
Re: Time Countup - by Snowman12 - 17.01.2012, 19:12
Re: Time Countup - by sameer419 - 17.01.2012, 19:24
Re: Time Countup - by selten98 - 17.01.2012, 19:27
Re: Time Countup - by sameer419 - 17.01.2012, 19:32
Re: Time Countup - by sameer419 - 17.01.2012, 19:37
Re: Time Countup - by Snowman12 - 17.01.2012, 20:19

Forum Jump:


Users browsing this thread: 1 Guest(s)