Jump to content
  • 0

Problema AFK fs


adytza

Question

[pawn]

#include <a_samp>

#define FILTERSCRIPT

#define AFKTime 30  //Cate minute poate fi AFK

#define ShowTime 1 //Activeaza / Dezactiveaza un mesaj trimis jucatorului care a primit kick (0 = nu / 1 = da)

#define Public 1  //Activeaza / Dezactiveaza mesajul care este trimis tuturor (0 = nu / 1 = da)

/*--------------------------NOTHING BELOW THIS POINT NEEDS TO BE CHANGED--------------------------*/

public OnFilterScriptInit()

{

SetTimer("AFKKicker", 60000, 1);

    return 1;

}

forward AFKKicker();

new Float:PPos[MAX_PLAYERS][3];

new AFKMins[MAX_PLAYERS];

new show = ShowTime;

new pub = Public;

public OnPlayerConnect(playerid)

{

PPos[playerid][0] = 0;

PPos[playerid][1] = 0;

PPos[playerid][2] = 0;

AFKMins[playerid] = 0;

}

public AFKKicker()

{

for(new i = 0; i <= MAX_PLAYERS; i++)

{

    if(PPos[1] == 0)

    {

        GetPlayerPos(i,PPos[0],PPos[1],PPos[2]);

        return 1;

}

new Float:x,Float:y,Float:z;

GetPlayerPos(i,x,y,z);

if(x == PPos[0] && y == PPos[1] && z == PPos[2])

{

    AFKMins++;

    if(AFKMins >= AFKTime)

    {

        if(show == 1)

        {

            new string[128];

            SendClientMessage(i, 0xAA3333AA," You was kick by AdmBot, reason: AFK longer than 30 minutes");

            SendClientMessage(i,0xAA3333AA,string);

}

else

{

      SendClientMessage(i, 0xAA3333AA," You was Away From Keyboard(AFK) for too long");

}

Kick(i);

if(pub == 1)

{

    new string[128];

    new name[MAX_PLAYER_NAME];

    GetPlayerName(i, name, sizeof(name));

            format(string, sizeof(string), " %s was kicked by AdmBot, reason: AFK longer than 30 minutes",name);

            SendClientMessageToAll(0xAA3333AA,string);

}

}

}

}

return 1;

}

[/pawn]

am si eu un fs dupa ce stai 30 min afk sa primesti kick , stau afk mai mult de 30 min si tot nu primesc kick

www.ucp.gamesiasi.ro

2ik8ow.jpg

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

#include <a_samp>
#define FILTERSCRIPT
#define AFKTime 30   //Cate minute poate fi AFK
#define ShowTime 1 //Activeaza / Dezactiveaza un mesaj trimis jucatorului care a primit kick (0 = nu / 1 = da)
#define Public 1  //Activeaza / Dezactiveaza mesajul care este trimis tuturor (0 = nu / 1 = da)

/*--------------------------NOTHING BELOW THIS POINT NEEDS TO BE CHANGED--------------------------*/

public OnFilterScriptInit()
{
	SetTimer("AFKKicker", 60000, 1);
    return 1;
}
forward AFKKicker();

new Float:PPos[MAX_PLAYERS][3];
new AFKMins[MAX_PLAYERS];
new show = ShowTime;
new pub = Public;

public OnPlayerConnect(playerid)
{
	PPos[playerid][0] = 0;
	PPos[playerid][1] = 0;
	PPos[playerid][2] = 0;
	AFKMins[playerid] = 0;
}
public AFKKicker()
{
	for(new i = 0; i <= MAX_PLAYERS; i++)
	{
	    if(PPos[i][1] == 0)
	    {
	        GetPlayerPos(i,PPos[i][0],PPos[i][1],PPos[i][2]);
	        return 1;
		}
		new Float:x,Float:y,Float:z;
		GetPlayerPos(i,x,y,z);
		if(x == PPos[i][0] && y == PPos[i][1] && z == PPos[i][2])
		{
		    AFKMins[i]++;
		    if(AFKMins[i] >= AFKTime)
		    {
		        if(show == 1)
		        {
		            new string[128];
		            SendClientMessage(i, 0xAA3333AA," You was kick by AdmBot, reason: AFK longer than 30 minutes");
		            SendClientMessage(i,0xAA3333AA,string);
				}
				else
				{
  			    	SendClientMessage(i, 0xAA3333AA," You was Away From Keyboard(AFK) for too long");
				}
				Kick(i);
				if(pub == 1)
				{
				    new string[128];
				    new name[MAX_PLAYER_NAME];
		    		GetPlayerName(i, name, sizeof(name));
		            format(string, sizeof(string), " %s was kicked by AdmBot, reason: AFK longer than 30 minutes",name);
		            SendClientMessageToAll(0xAA3333AA,string);
                                          Kick(name);
				}
			}
		}
	}
	return 1;
}

rszadc33936a6e246e39ea2.png
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.