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



GetTickCount ? - [D]ry[D]esert - 23.05.2012

Is GetTickCount to count ? i mean what does it do exactly, is it When player Type /kill :
10 sec to die
9 sec to die
8 sec to die
or somthing like this ?


Re: GetTickCount ? - Jonny5 - 23.05.2012

no

https://sampwiki.blast.hk/wiki/GetTickCount
Returns the uptime of the actual server in milliseconds.


Re: GetTickCount ? - [FMJ]PowerSurge - 23.05.2012

It gets how many ticks have passed since the server started. It returns the uptime of the server in milliseconds.

For example, if the server has been open for two seconds, GetTickCount would return 2000. (1000 ms in one second)


Re: GetTickCount ? - iggy1 - 23.05.2012

GetTickCount() returns the amount of milliseconds the machine your server is running has been up.

tickcount returns the amount of milliseconds that your sa-mp server has been up.

https://sampwiki.blast.hk/wiki/GetTickCount
https://sampwiki.blast.hk/wiki/Tickcount


Re: GetTickCount ? - [D]ry[D]esert - 23.05.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
no

https://sampwiki.blast.hk/wiki/GetTickCount
Returns the uptime of the actual server in milliseconds.
Quote:
Originally Posted by [FMJ]PowerSurge
Посмотреть сообщение
It gets how many ticks have passed since the server started. It returns the uptime of the server in milliseconds.

For example, if the server has been open for two seconds, GetTickCount would return 2000. (1000 ms in one second)
Okey any another Example of it ?
And How could i make when player type /kill it count and send for player how many sec untill he died ?


Re: GetTickCount ? - [FMJ]PowerSurge - 23.05.2012

It's best to use a timer for that (SetTimerEx("Killplayer", 1000, 0, "i", playerid))

pawn Код:
new Killcount[MAX_PLAYERS];
pawn Код:
if(!strcmp("/kill", cmdtext, true))
{
    Killcount[playerid] = 10; // 10 seconds
    SetTimerEx("KillPlayer", 1000, 0, "i", playerid); //Check every second for Killcount.
    new str[10]; format(str, 10, "%d...", Killcount[playerid]);
    SendClientMessage(playerid, -1, str);
    return 1;
}
pawn Код:
forward KillPlayer(playerid);
public KillPlayer(playerid)
{
    switch(Killcount[playerid])
    {
        case 0: return SetPlayerHealth(playerid, 0.0);
        default:
        {
            SetTimerEx("KillPlayer", 1000, 0, "i", playerid);
            new str[10]; format(str, 10, "%d...", Killcount[playerid]);
            Killcount[playerid] -= 1;
            SendClientMessage(playerid, -1, str);
        }
    }
}



Re: GetTickCount ? - Sanady - 23.05.2012

Quote:
Originally Posted by [FMJ]PowerSurge
Посмотреть сообщение
It's best to use a timer for that (SetTimerEx("Killplayer", 1000, 0, "i", playerid))

pawn Код:
new Killcount[MAX_PLAYERS];
pawn Код:
if(!strcmp("/kill", cmdtext, true))
{
    Killcount[playerid] = 10; // 10 seconds
    SetTimerEx("KillPlayer", 1000, 0, "i", playerid); //Check every second for Killcount.
    new str[10]; format(str, 10, "%d...", Killcount[playerid]);
    SendClientMessage(playerid, -1, str);
    return 1;
}
pawn Код:
forward KillPlayer(playerid);
public KillPlayer(playerid)
{
    switch(Killcount[playerid])
    {
        case 0: return SetPlayerHealth(playerid, 0.0);
        default:
        {
            SetTimerEx("KillPlayer", 1000, 0, "i", playerid);
            new str[10]; format(str, 10, "%d...", Killcount[playerid]);
            Killcount[playerid] -= 1;
            SendClientMessage(playerid, -1, str);
        }
    }
}
I don`t think so this will work..


Re: GetTickCount ? - [D]ry[D]esert - 23.05.2012

Quote:
Originally Posted by [FMJ]PowerSurge
Посмотреть сообщение
It's best to use a timer for that (SetTimerEx("Killplayer", 1000, 0, "i", playerid))

pawn Код:
new Killcount[MAX_PLAYERS];
pawn Код:
if(!strcmp("/kill", cmdtext, true))
{
    Killcount[playerid] = 10; // 10 seconds
    SetTimerEx("KillPlayer", 1000, 0, "i", playerid); //Check every second for Killcount.
    new str[10]; format(str, 10, "%d...", Killcount[playerid]);
    SendClientMessage(playerid, -1, str);
    return 1;
}
pawn Код:
forward KillPlayer(playerid);
public KillPlayer(playerid)
{
    switch(Killcount[playerid])
    {
        case 0: return SetPlayerHealth(playerid, 0.0);
        default:
        {
            SetTimerEx("KillPlayer", 1000, 0, "i", playerid);
            new str[10]; format(str, 10, "%d...", Killcount[playerid]);
            Killcount[playerid] -= 1;
            SendClientMessage(playerid, -1, str);
        }
    }
}
Thanks But What does Mean
pawn Код:
Killcount[playerid] -= 1;



Re: GetTickCount ? - [D]ry[D]esert - 23.05.2012

Quote:
Originally Posted by Sanady
Посмотреть сообщение
I don`t think so this will work..
u are Right


Re: GetTickCount ? - [D]ry[D]esert - 25.05.2012

Quote:
Originally Posted by [FMJ]PowerSurge
Посмотреть сообщение
It's best to use a timer for that (SetTimerEx("Killplayer", 1000, 0, "i", playerid))

pawn Код:
new Killcount[MAX_PLAYERS];
pawn Код:
if(!strcmp("/kill", cmdtext, true))
{
    Killcount[playerid] = 10; // 10 seconds
    SetTimerEx("KillPlayer", 1000, 0, "i", playerid); //Check every second for Killcount.
    new str[10]; format(str, 10, "%d...", Killcount[playerid]);
    SendClientMessage(playerid, -1, str);
    return 1;
}
pawn Код:
forward KillPlayer(playerid);
public KillPlayer(playerid)
{
    switch(Killcount[playerid])
    {
        case 0: return SetPlayerHealth(playerid, 0.0);
        default:
        {
            SetTimerEx("KillPlayer", 1000, 0, "i", playerid);
            new str[10]; format(str, 10, "%d...", Killcount[playerid]);
            Killcount[playerid] -= 1;
            SendClientMessage(playerid, -1, str);
        }
    }
}
I recive Errors