Help Me With Timer Please
#1

Thanks, Guys for help me
Removed
Reply
#2

TextDrawSetString should do it, if you don't know how to code it with this function or you need example tell me.

NOTE: you need to create a per player textdraw and update their string, otherwise if tried to jail 2 players the string of both will be mixed together.
Reply
#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
#4

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
TextDrawSetString should do it, if you don't know how to code it with this function or you need example tell me.

NOTE: you need to create a per player textdraw and update their string, otherwise if tried to jail 2 players the string of both will be mixed together.
Guys, i have exactly this problem with mixed strings. Any example how to solve it please?

1. When i use TextDrawSetString + TextDrawShowForPlayer i have problem with 2 players mixing string.
2. When i use CreatePlayerTextDraw + PlayerTextDrawShow i have problem that textdraw dissapere for no reason after 3 minutes...

Any idea how to solve?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)