#1

Ok i know how to create a timer but what i wanted to know is how i could have the time showing on the players screen like counting down from 60 seconds i dont want it in the normal message box but in the place where normal a message appears if a admin does /ann.

Many thanks.

(will rep ofc))
Reply
#2

Use GameTextForAll

https://sampwiki.blast.hk/wiki/GameTextForAll
Reply
#3

https://sampwiki.blast.hk/wiki/GameTextForAll

https://sampwiki.blast.hk/wiki/TextDrawShowForAll

Edit: Nvm
Reply
#4

Ok but how do i make it work with the timer that is what im not 100% about. (im 0% sure how lol)
Reply
#5

Quote:
Originally Posted by manchestera
Посмотреть сообщение
Ok but how do i make it work with the timer that is what im not 100% about. (im 0% sure how lol)
For example:

PHP код:
forward Counting(playerid); 
PHP код:
public Counting(playerid)
{
        
Count 1;
        
GameTextForAll("~y~3",1000,6);
        return 
1;

Now you can use SetTimer

PHP код:
SetTimer("Counting",1000,false); 
https://sampwiki.blast.hk/wiki/SetTimer
Reply
#6

This should be sufficient:

pawn Код:
// In OnGameModeInit or wherever the timer is supposed to start...
new
    iTimedCountdown = -1,
    rCountdownHandle;
   
rCountdownHandle = SetTimer("TimedCountdown", 1000, true);

// Somewhere outside of a function
forward TimedCountdown();
public TimedCountdown() {
    if(iTimedCountdown == -1) {
        iTimedCountdown = 61;
    }
   
    new
        szMessage[10];

    iTimedCountdown--;
    format(szMessage, sizeof(szMessage), "~r~%d..."); // Add more in if you wish.
   
    GameTextForAll(szMessage, 950, 3);
   
    if(iTimedCountdown == 0) {
        KillTimer(rCountdownHandle);
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Calgon
Посмотреть сообщение
This should be sufficient:

pawn Код:
// In OnGameModeInit or wherever the timer is supposed to start...
new
    iTimedCountdown = -1,
    rCountdownHandle;
   
rCountdownHandle = SetTimer("TimedCountdown", 1000, true);

// Somewhere outside of a function
forward TimedCountdown();
public TimedCountdown() {
    if(iTimedCountdown == -1) {
        iTimedCountdown = 61;
    }
   
    new
        szMessage[10];

    iTimedCountdown--;
    format(szMessage, sizeof(szMessage), "~r~%d..."); // Add more in if you wish.
   
    GameTextForAll(szMessage, 950, 3);
   
    if(iTimedCountdown == 0) {
        KillTimer(rCountdownHandle);
    }
    return 1;
}
will tis send the text to everyone tu as i only want it sent to the player that uses the command?


edit also i just tried it ingame and it didnt work nothing came up on the screen.
Reply
#8

Ok got it working (loaded th old gm versionlol) New problem now is it just flash 1 not count down from 60 to 0

Код:
forward TimedCountdown();
public TimedCountdown() {
    if(iTimedCountdown == -1) {
        iTimedCountdown = 61;
    }
    
    new
        szMessage[10];

    iTimedCountdown--;
    format(szMessage, sizeof(szMessage), "~r~%d..."); // Add more in if you wish.
    
    GameTextForAll(szMessage, 950, 3);
    
    if(iTimedCountdown == 0) {
        KillTimer(rCountdownHandle);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)