10 minute timer count down, then map changes? -
Elysian` - 13.05.2012
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.
Re: 10 minute timer count down, then map changes? -
Yuryfury - 13.05.2012
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
Re: 10 minute timer count down, then map changes? -
miley1 - 13.05.2012
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
Re: 10 minute timer count down, then map changes? -
Elysian` - 13.05.2012
I cannot do timers can someone do it for now...
Also,
Above, wtf? I want it when the GM starts.
Re: 10 minute timer count down, then map changes? -
Jonny5 - 13.05.2012
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
Re: 10 minute timer count down, then map changes? -
miley1 - 13.05.2012
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
Re: 10 minute timer count down, then map changes? -
Elysian` - 13.05.2012
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.
Re: 10 minute timer count down, then map changes? -
miley1 - 13.05.2012
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
Re: 10 minute timer count down, then map changes? -
Elysian` - 13.05.2012
Why would you even do that when I stated 10 minutes and not 60 seconds?
Re: 10 minute timer count down, then map changes? -
Yuryfury - 13.05.2012
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.