Server restart CMD help.
#1

Hello,

I want a command like this:

Код:
/arestart [seconds]
Код:
If I have typed that it will give this:
SendClientMessageToAll(COLOR_RED, "[RESTART] {FFFF00} There will be a restart coming up in like [SECONDS] seconds!");
How can I create it like that? ^^

Thanks.
Reply
#2

pawn Код:
CMD:arestart(pid, params[]) {
    new seconds;
    if(sscanf(params, "d", seconds)) return SCM(...errorstuff);

    SendClientMessageToAll(COLOR_RED, "[RESTART] {FFFF00} There will be a restart coming up in like [SECONDS] seconds!");
    SetTimer("Restart", seconds*1000, 0);
    return 1;
}
forward Restart();
public Restart() {
    return SendRconCommand("gmx");
}
Should work, but I don't know if you can use gmx like that
Reply
#3

Requires ZCMD or YCMD and sscanf.
pawn Код:
CMD:arestart(playerid, params[]) {
    new seconds;
    if(sscanf(params, "d", seconds))
        return SendClientMessage(playerid, -1, "/arestart (seconds)");
    SetTimer("restarttimer", seconds, false); // Starts the timer with the amount of seconds you entered.
    return true;
}

forward restarttimer();
public restarttimer() {
    // Saving stuff here.
    SendRconCommand("gmx"); // As soon as the timer finishes it'll restart the server.
}
Reply
#4

Thank you guys <3
Reply
#5

I need this too,thanks,only one more question,can you make a textdraw in the bottom left (above radar) ,in that textdraw should only be "Second until restart: "
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)