21.04.2010, 18:03
Код:
//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; }