GameModeTextShowForPlayer question
#1

Hello one question im making a jail command and i did it and i do for gametextshowforplayer something like this

time[targetid] = 3600000;
format(time,sizeof(time), "Vreme Zatvora: %d",time);
GameTextForPlayer(targetid,time,5000,3);

i have one question now how to make gametextshowforplayer that will repeat every second with one second down like if he have 3600 sec to after one sec 3599 that he can see
Reply
#2

pawn Код:
new timercount[MAX_PLAYERS] = 0;

//In the command
time[targetid] = 3600000;
timercount[targetid] = SetTimerEx("CountTimer", 1000, true, "i", targetid);


//function
forward CountTimer(playerid)
public CountTimer(playerid);
{
time[playerid]--;
new time[50];
format(time,sizeof(time), "Vreme Zatvora: %d",time[playerid);
GameTextForPlayer(playerid, time ,5000,3);

if(time[playerid] == 0)
{
   KillTimer(timercount[playerid]);
  // Releasing from jail code
   return 1;
 }
return 1;
}
Reply
#3

i tryed something like it thank you some member tell me to make something like it but it not work for me lol
Reply
#4

dont work dont tick the gametext good
Reply
#5

PHP код:
new JailTimer[MAX_PLAYERS];
time[targetid] = 60//Time (60 seconds -> 1 minute)
JailTimer[targetid] = SetTimerEx("TimeOut"1000true"i"targetid);
forward TimeOut(playerid)
public 
TimeOut(playerid);
{
    
time[playerid] -= 1;
    if(
time[playerid] <= 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
time[playerid] = 0;
            
KillTimer(JailTimer[playerid]);
            
SendClientMessage(playerid, -1"You have left prison");
            return 
1;
        }
    }
    
    new 
str[24]; format(strsizeof str"Time:_%d"TimeConvert(time[playerid]));
    
GameTextForPlayer(playeridstr20003);
    return 
1;
}
TimeConvert(seconds)
{
    new 
tmp[16];
     new 
minutes floatround(seconds/60);
      
seconds -= minutes*60;
       
format(tmpsizeof(tmp), "%d:%02d"minutesseconds);
       return 
tmp;

Reply
#6

dont work it dont convert good it get me unjailed for one sec i dont get gametext so dont work
Reply
#7

fixed it put something from me and it work i only need gametextforplayer
Reply
#8

Sorry I was wrong, it must be like this:

PHP код:
new str[24]; format(strsizeof str"Time:_%s"TimeConvert(time[playerid])); 
GameTextForPlayer(playeridstr20003); 
Reply
#9

i fixed leaving in second with onplayerupdate now how to make gametext that will repeat every second it only show it to me and not change time
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)