restart seconds
#1

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

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

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

Oh i forgot about that, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)