Check every 5s help
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If you want to use parameters such as playerid, you'll need to use SetTimerEx. But I recommend you to use SetTimer and a loop through the players:
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

new Something_Timer;
new b=30;

public OnFilterScriptInit()
{
    Something_Timer = SetTimer("OnSomethingUpdate", 5000, true);
    return 1;
}

public OnFilterScriptExit()
{
    KillTimer(Something_Timer);
    return 1;
}

forward OnSomethingUpdate();
public OnSomethingUpdate()
{
    new Float:x, Float:y, Float:z;
    for (new playerid; playerid != MAX_PLAYERS; ++playerid)
    {
        if (!IsPlayerConnected(playerid)) continue;
        SendClientMessage(playerid,-1,"Preostalo vam je jos kiseonika za 15s ronjenja");
        GetPlayerPos(playerid, x, y, z);
        if(z<=0)
        {
            b=b-5;
            if (b=15) SendClientMessage(playerid,-1,"Preostalo vam je jos kiseonika za 15s ronjenja");
            else if (b=5) SendClientMessage(playerid,-1,"Preostalo vam je jos kiseonika za 5s ronjenja");
            else if (b=0)
            {
                SetPlayerHealth(playerid, 0);
                b=30;
            }
        }
        if (z>0)
        {
            b=30;
        }
    }
}
Although I'm not so sure about the "b" symbol. It's the same for every person so it gets modified. If you want to be for each player, then use an array.
Can u change it to array? Because idk how to store it for each player. I mean how do i know number of elements and how to check for each player? Thanks
Reply


Messages In This Thread
Check every 5s help - by jovapeba - 10.04.2014, 17:04
Re: Check every 5s help - by Konstantinos - 10.04.2014, 17:11
Re: Check every 5s help - by Patrick - 10.04.2014, 17:12
Re: Check every 5s help - by jovapeba - 10.04.2014, 17:31
Re: Check every 5s help - by Konstantinos - 10.04.2014, 17:38
Re: Check every 5s help - by jovapeba - 10.04.2014, 17:41
Re: Check every 5s help - by Konstantinos - 10.04.2014, 17:47

Forum Jump:


Users browsing this thread: 1 Guest(s)