Timer help. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timer help. (
/showthread.php?tid=254072)
Timer help. -
iGetty - 09.05.2011
[ame]http://www.youtube.com/watch?v=3SiqImuFZ8s[/ame]
How could I get it to stop at 0, and kill the timer?
AND
If it reaches 0, send an RCON command, of GMX, to restart the server?
Thanks.
Re: Timer help. -
(SF)Noobanatior - 09.05.2011
post the timer code
Re: Timer help. -
iGetty - 09.05.2011
pawn Код:
new count = 30;
COMMAND:plantbomb(playerid, params[])
{
SetTimerEx("bomb", 1000, 1, "d", playerid);
return 1;
}
public bomb(playerid)
{
count--;
new string[100];
format(string, sizeof(string), "~w~BOMB EXPLODES in~r~~n~ %d ~w~SECONDS!", count);
return GameTextForPlayer(playerid, string, 1000, 5);
}
Re: Timer help. -
Tee - 09.05.2011
pawn Код:
new count = 30,BombTimer[The_Max_Players_In_Your_Server];//At the top (Global Variable)
COMMAND:plantbomb(playerid, params[])
{
BombTimer[playerid] = SetTimerEx("bomb", 1000, 1, "d", playerid);
return 1;
}
public bomb(playerid)
{
count--;
new string[100];
if(count > 0)
{
format(string, sizeof(string), "~w~BOMB EXPLODES in~r~~n~ %d ~w~SECONDS!", count);
GameTextForPlayer(playerid, string, 1000, 5);
}
if(count == 0)
{
KillTimer(BombTimer[playerid]);
SendRconCommand("gmx");
}
}
Re: Timer help. -
(SF)Noobanatior - 09.05.2011
like this
pawn Код:
new count = 30;
new bombtimer[MAX_PLAYERS];
COMMAND:plantbomb(playerid, params[])
{
bombtimer[playerid] = SetTimerEx("bomb", 1000, 1, "d", playerid);
return 1;
}
public bomb(playerid)
{
count--;
new string[100];
if(count > 0){
format(string, sizeof(string), "~w~BOMB EXPLODES in~r~~n~ %d ~w~SECONDS!", count);
GameTextForPlayer(playerid, string, 1000, 5);
}
else{
KillTimer(bombtimer[playerid]);
//createexplosion
SendRconCommand(gmx);
}
return 1;
}
haha to slow aye
Re: Timer help. -
Tee - 09.05.2011
Great minds think alike huh
And you need to fix your SendRconComand.
From: SendRconComand(gmx); - Without the quotation marks.
To: SendRconComand("gmx"); - With the quotation marks.
Also you should let him decide the array size, "MAX_PLAYERS" 500 and he might not have 500 players. That would be a waste of memory, unless he did.
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS [The number of players in his server]
Re: Timer help. -
(SF)Noobanatior - 09.05.2011
lol yeah there pretty similar
Re: Timer help. -
iGetty - 09.05.2011
Thanks guys! I will let you know the outcome! It's a search and destroy server, so I thought I'd be different!
Re: Timer help. -
Tee - 09.05.2011
Glad we could help. Mind sharing the IP? I randomly popup on some servers

.
Re: Timer help. -
iGetty - 09.05.2011
Aye course, but it is not on at the minute

I will give you an inbox, and also, could you help with me getting this :
pawn Код:
COMMAND:defusebomb(playerid, params[])
if(IsPlayerInRangeOfPoint(playerid, 2.5, -122.9514,1681.7955,35.6662))
{
KillTimer(bombtimer[playerid]);
return 1;
}
Telling me this :
Код:
C:\Documents and Settings\d\Desktop\lvrp\Windows\gamemodes\new.pwn(268) : warning 209: function "cmd_defusebomb" should return a value
Because IG I get this : Server: UNKNOWN COMMAND.