10 minute timer count down, then map changes?
#1

Title says it,

How would I make a timer count down in a text draw? then the map changes? I got SendRconCommand("changemode MAPHERE); blah blah but I wanna know how to make a timer count down in a text draw.
Reply
#2

1. Create the textdraw's position, font etc. (Look at clock.pwn which comes with the server. Clean and simple)
2. Set a timer to be called every second
3. Create and forward a new callback (called by the timer)
4. Create a variable "seconds" at the top of the script
5. Subtract 1 from seconds under the new callback
6. Use TextDrawSetString
7. when seconds=0 send the rcon command
Reply
#3

Quote:

if(strcmp(cmd, "/countdown", true) == 0)
{
if (PlayerInfo[playerid]
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /coutdown [seconds(3-60)]");
return 1;
}
new countdowns = strval(tmp);
if((countdowns > 60 || countdowns < 3) && PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY,"* Seconds must not go above 60 or below 3!");
if(CountdownRunning == 0)
{
CountdownRunning = 1;
CountdownSeconds = countdowns;
CountdownTimer = SetTimer("CountDown",1000,true);
format(string, sizeof(string),"~p~Countdown: ~w~%d",countdowns);
TextDrawSetString(Textdraw46, string);
TextDrawShowForAll(Textdraw46);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Announced a Countdown: [Seconds: %s]",d,m,y,h,mi,s,sendername, countdowns);
AdminLog(string);
}
else
{
KillTimer(CountdownTimer);
TextDrawHideForAll(Textdraw46);
CountdownRunning = 1;
CountdownSeconds = countdowns;
CountdownTimer = SetTimer("CountDown",1000,true);
format(string, sizeof(string),"~p~Countdown: ~w~%d",countdowns);
TextDrawSetString(Textdraw46, string);
TextDrawShowForAll(Textdraw46);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Announced a Countdown: [Seconds: %s]",d,m,y,h,mi,s,sendername, countdowns);
AdminLog(string);
}
}
return 1;
}

i think like this
Reply
#4

I cannot do timers can someone do it for now...
Also,
Above, wtf? I want it when the GM starts.
Reply
#5

as a scripter "cannot" should not be something you say!

if you wont take the time to learn why would someone bother trying to help.

their is many many examples of making timers and using them you should have no trouble finding the info you need.
And at the same time youll learn something new and be able to say "I can create timers"

I would be glad to help you learn how to create a timer
but wont just code the solution for you
Reply
#6

Quote:
Originally Posted by Windows32
Посмотреть сообщение
I cannot do timers can someone do it for now...
Also,
Above, wtf? I want it when the GM starts.
i toke time to create this for you , Next time ill see you posting for something ill say This guy aint worth it , anyway i thought u wanted a countdown for something my english aint good but nvm im done here
Reply
#7

Quote:
Originally Posted by miley1
Посмотреть сообщение
i toke time to create this for you , Next time ill see you posting for something ill say This guy aint worth it , anyway i thought u wanted a countdown for something my english aint good but nvm im done here
Really? You obviously copied and pasted because the /countdown command only goes upto 60 seconds, and I stated 10 minutes.
Reply
#8

nah , i got no countdown i used to script for roleplay servers and race servers and writed this in a notepad and paste it in here
Reply
#9

Why would you even do that when I stated 10 minutes and not 60 seconds?
Reply
#10

This isn't the script request thread. You asked for help on how to do it, we told you (and provided examples). The rest is up to you.

As mentioned before, look at the clock.pwn that comes with the server. It used both timers and textdraws in a simple and clean fashion.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)