Help Me With Timer Please
#3

oh had same problem so my suggestions
make a variable for jailed,jail min and jail second i will so u my code
make a timer running every second of game show that textdraw when player spawns instead of showing it each second but for first time when u create the textdraw set it empty. " " like this, Make loop from all players in that timer then check player is spawed or not and then check if he is jailed and all code..
pawn Код:
if(PlayerInfo[playerid][pJailed])// my variable for checking that is player jailed or not
{
    if (PlayerInfo[playerid][pJailHour] >= 0 && PlayerInfo[playerid][pJailMinute] > 0) PlayerInfo[playerid][pJailMinute] --;//
    if (PlayerInfo[playerid][pJailHour] > 0 && PlayerInfo[playerid][pJailMinute] == 0)
    {
        PlayerInfo[playerid][pJailHour] --;
        PlayerInfo[playerid][pJailMinute] = 59;
    }

    if (PlayerInfo[playerid][pJailHour] < 10) format(string, sizeof(string), "0%d",PlayerInfo[playerid][pJailHour]);
    else format(string, sizeof(string), "%d",PlayerInfo[playerid][pJailHour]);

    if (PlayerInfo[playerid][pJailMinute] < 10) format(string, sizeof(string), "%s:0%d",string,PlayerInfo[playerid][pJailMinute]);
    else format(string, sizeof(string), "%s:%d",string,PlayerInfo[playerid][pJailMinute]);

    format(string, sizeof(string), "~w~Jail Time: ~g~%s",string);

    if(PlayerInfo[playerid][pJailHour] == 0 && PlayerInfo[playerid][pJailMinute] == 0)
    {
        GameTextForPlayer(playerid,"~w~Jail Sentence Complete~n~Released.", 5000, 3);
        SendClientMessage(playerid,COLOR_SKYBLUE, "Your Jail Sentence Is Complete. Released From Jail.");
        UnJail(playerid);
        format(string, sizeof(string),"",string);
    }
    TextDrawSetString(StatsDisplay[playerid], string);
}
StatsDisplay[playerid] this is my textdraw.
PlayerInfo[playerid][pJailHour] this is the variable for storing the jail minute in real and hour of game
PlayerInfo[playerid][pJailMinute] this is the variable for storing the jail seconds in real and minute in game
Reply


Messages In This Thread
Help Me With Timer Please - by FisherMan - 15.09.2014, 14:48
Re: Help Me With Timer Please - by SilentSoul - 15.09.2014, 14:51
Re: Help Me With Timer Please - by AroseKhanNiazi - 15.09.2014, 14:57
Re: Help Me With Timer Please - by ThomasEvil - 19.07.2017, 03:57

Forum Jump:


Users browsing this thread: 1 Guest(s)