Timer help.
#1

[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.
Reply
#2

post the timer code
Reply
#3

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);
}
Reply
#4

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");
    }
}
Reply
#5

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
Reply
#6

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]
Reply
#7

lol yeah there pretty similar
Reply
#8

Thanks guys! I will let you know the outcome! It's a search and destroy server, so I thought I'd be different!
Reply
#9

Glad we could help. Mind sharing the IP? I randomly popup on some servers .
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)