SA-MP Forums Archive
Server restart CMD 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)
+--- Thread: Server restart CMD help. (/showthread.php?tid=418399)



Server restart CMD help. - Aarab - 24.02.2013

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.


Re: Server restart CMD help. - Misiur - 24.02.2013

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


Re: Server restart CMD help. - Boolean - 24.02.2013

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



Re: Server restart CMD help. - Aarab - 24.02.2013

Thank you guys <3


Re: Server restart CMD help. - ZeroCools - 24.02.2013

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: "