SA-MP Forums Archive
restart seconds - 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: restart seconds (/showthread.php?tid=318877)



restart seconds - Tanush123 - 16.02.2012

Well for some reason when i use /gmx [seconds], on my SendClientMesasge the second are right but for some reason it just instantly restarts when i use /gmx, like when i use /gmx 10 it restarts after i type the command (1 millisecond)
pawn Код:
CMD:gmx(playerid,params[])
    {
        if(PlayerData[playerid][AdminLevel] > 3)
        {
            if(sscanf(params,"d",seconds)) return SCM(playerid,grey,"USAGE: /gmx [seconds]");
            GetPlayerName(playerid,Nam,sizeof(Nam));
            format(str,sizeof(str),"Admin %s is going to restart the server in %d seconds!!!!!!",Nam,seconds);
            SendClientMessageToAll(red,str);
            GameTextForAll("Server Restart",seconds,6);
            SetTimer("Restart",seconds,0);
        }
        else return 0;
        return 1;
    }



Re: restart seconds - Shetch - 16.02.2012

Код:
SetTimer("Restart",seconds*1000,0);



Re: restart seconds - ReneG - 16.02.2012

Quote:
Originally Posted by Shetch
Посмотреть сообщение
Код:
SetTimer("Restart",seconds*1000,0);
Exactly like this.

SetTimer reads time in milliseconds, not in any unit of time you want. Therefore, you have to compensate for it, and multiply it according to your desired unit of time. This is all 6th grade math here.


Re: restart seconds - Tanush123 - 16.02.2012

Oh i forgot about that, thanks