//AFK new Float:afkx, Float:afky, Float:afkz; new Float:afkxdopo, Float:afkydopo, Float:afkzdopo; new afkpos; new afkpos1; new coloreini; forward ControlloAFK(); forward ControlloAFK1(i); new IsAfk[MAX_PLAYERS] = 0; new originame[MAX_PLAYERS][24];
stock PlayerPosPrima(playerid) {
GetPlayerPos(playerid, afkx, afky, afkz);
return afkpos;
}
stock PlayerPosDopo(playerid) {
GetPlayerPos(playerid, afkxdopo, afkydopo, afkzdopo);
return afkpos1;
}
public ControlloAFK()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsAfk[i] != 0){
afkpos = PlayerPosPrima(i);
SetTimerEx("ControlloAFK1", 60000, false, "i",i);
} else {
afkpos = PlayerPosPrima(i);
SetTimerEx("ControlloAFK1", 15000, false, "i", i);
}
}
}
return 1;
}
public ControlloAFK1(i)
{
coloreini = GetPlayerColor(i);
afkpos1 = PlayerPosDopo(i);
new string[128];
if(afkpos == afkpos1 && IsAfk[i] != 1)
{
SetPlayerColor(i, COLOR_GREEN);
IsAfk[i] = 1;
SetTimer("ControlloAFK", 3000, false);
format(string, sizeof(string), "%s и AFK (Away From KeyBoard)", PlayerName(i));
SendClientMessageToAll(COLOR_GREEN,string);
new name[MAX_PLAYER_NAME];
format(name,MAX_PLAYER_NAME,"[AFK]%s",PlayerName(i));
SetPlayerName(i,name);
} else if(afkpos != afkpos1 && IsAfk[i] == 1)
{
SetPlayerColor(i, coloreini);
IsAfk[i] = 0;
SetTimer("ControlloAFK", 3000, false);
format(string, sizeof(string), "%s и tornato", PlayerName(i));
SendClientMessageToAll(COLOR_GREEN,string);
SetPlayerName(i,originame[i]);
} else if(afkpos != afkpos1 && IsAfk[i] != 1)
{
IsAfk[i] = 0;
SetTimer("ControlloAFK", 3000, false);
} else SetTimer("ControlloAFK", 3000, false);
return 1;
}
#include <a_samp>
#define AFK_TIME 30000
new bool:respond[MAX_PLAYERS];
forward CheckAFK();
public OnGameModeInit()
{
SetTimer("CheckAFK", AFK_TIME, 1);
return 1;
}
public CheckAFK(){
new i = -1;
while(++i < MAX_PLAYERS){
if(!IsPlayerConnected(i)) continue;
if(respond[i] == false){ // Keel them for being AFK
SendClientMessage(i, 0xFFFFFFFF, "You are away from keyboard!");
printf("Playerid %i is AFK", i);
}
else respond[i] = false;
}
}
public OnPlayerUpdate(playerid)
{
if(respond[playerid] == false){
respond[playerid] = true;
}
return 1;
}
SendClientMessage(i, 0xFFFFFFFF, "You are away from keyboard!");
printf("Playerid %i is AFK", i);
|
Originally Posted by [IF
MavericK ]
And when player is back? |
|
Originally Posted by [SU
|