Checking time a player is online
#5

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
pawn Код:
#include <a_samp>
#include <foreach>

new Time[MAX_PLAYERS];
public OnFilterScriptInit() //Or OnGameModeInit() if you're using a Game Mode.
{
    SetTimer("PlayerTime", 1000, true);
    return 1;
}

public OnPlayerConnect(playerid)
{
    Time[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    Time[playerid] = 0;
    return 1;
}

forward PlayerTime();
public PlayerTime()
{
    /*for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        { //If you're not using the 'foreach' include.*/

    foreach(Player, i)
    {
        if(Time[i] < 7200)
        {
            Time[i]++;
        }
        else
        {
            SendClientMessage(i, 0xFFFF00FF, "You Have Reached 2 Hours Of Playing Time. Therefore You Have Been Kicked For Reaching The Limit.");
            Kick(i);
        }
    }
    return 1;
}
You need to explain why they're getting kicked. You will need the foreach include for this script, otherwise you can use the commented lines as an alternative.
Thanks for the response.
Reply


Messages In This Thread
Checking time a player is online - by Glint - 29.08.2012, 07:54
Respuesta: Checking time a player is online - by admantis - 29.08.2012, 07:57
Re: Checking time a player is online - by Glint - 29.08.2012, 08:02
Re: Checking time a player is online - by clarencecuzz - 29.08.2012, 08:10
Re: Checking time a player is online - by Glint - 29.08.2012, 08:12
Re: Checking time a player is online - by iggy1 - 29.08.2012, 08:18

Forum Jump:


Users browsing this thread: 1 Guest(s)