SA-MP Forums Archive
Timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer (/showthread.php?tid=295077)



Timer - manchestera - 04.11.2011

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))


Re: Timer - Speed - 04.11.2011

Use GameTextForAll

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


Re: Timer - =WoR=G4M3Ov3r - 04.11.2011

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

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

Edit: Nvm


Re: Timer - manchestera - 04.11.2011

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


Re: Timer - =WoR=G4M3Ov3r - 04.11.2011

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


Re: Timer - Calgon - 04.11.2011

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;
}



Re: Timer - manchestera - 04.11.2011

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.


Re: Timer - manchestera - 04.11.2011

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;
}