02.11.2017, 12:04
Se eu fosse usar, eu faria dessa forma;
bom trabalho, mano.
PHP код:
// sгo dois arquivos. caso alguйm nгo tenha entendido.
/*
# db db d88888b .d8b. d8888b. d88888b d8888b. d888888b d8b db .o88b.
# 88 88 88' d8' `8b 88 `8D 88' 88 `8D `88' 888o 88 d8P Y8
# 88ooo88 88ooooo 88ooo88 88 88 88ooooo 88oobY' 88 88V8o 88 8P
# 88~~~88 88~~~~~ 88~~~88 88 88 88~~~~~ 88`8b 88 88 V8o88 8b
# 88 88 88. 88 88 88 .8D 88. 88 `88. db .88. 88 V888 Y8b d8
# YP YP Y88888P YP YP Y8888D' Y88888P 88 YD VP Y888888P VP V8P `Y88P'
*/
#if defined _inc_header
#undef _inc_header
#endif
#include <YSI\y_groups>
#include <YSI\y_commands>
#include <YSI\y_hooks>
new
Group:Group_AFK,
Player_Name[MAX_PLAYERS][MAX_PLAYER_NAME],
Player_TimeAfk[MAX_PLAYERS];
/*
# d88888b d8b db d8888b. .d88b. d88888b d88888b d888888b db d88888b
# 88' 888o 88 88 `8D .8P Y8. 88' 88' `88' 88 88'
# 88ooooo 88V8o 88 88 88 88 88 88ooo 88ooo 88 88 88ooooo
# 88~~~~~ 88 V8o88 88 88 88 88 88~~~ 88~~~ 88 88 88~~~~~
# 88. 88 V888 88 .8D `8b d8' 88 88 .88. 88booo. 88.
# Y88888P VP V8P Y8888D' `Y88P' YP YP Y888888P Y88888P Y88888P
*/
// [...]
// [...]
// [...]
/*
# d888888b .88b d88. d8888b. db d888888b d8b db .o88b.
# `88' 88'YbdP`88 88 `8D 88 `88' 888o 88 d8P Y8
# 88 88 88 88 88oodD' 88 88 88V8o 88 8P
# 88 88 88 88 88~~~ 88 88 88 V8o88 8b
# .88. 88 88 88 88 88booo. db .88. 88 V888 Y8b d8
# Y888888P YP YP YP 88 Y88888P VP Y888888P VP V8P `Y88P'
*/
#if defined _inc_impl
#undef _inc_impl
#endif
hook OnGameModeInit()
{
Group_AFK = Group_Create("AFK");
return true;
}
hook OnPlayerConnect(playerid)
{
GetPlayerName(playerid, Player_Name[playerid], MAX_PLAYER_NAME);
return true;
}
YCMD:ausentes(playerid, params[], help)
{
new
tmp_str[128];
SendClientMessage(playerid, -1, "Exibindo jogadores ausentes:");
foreach(new i : GroupMember(Group_AFK))
{
format(tmp_str, sizeof tmp_str, " %s - %i", Player_Name[playerid], gettime() - Player_TimeAfk[playerid]);
SendClientMessage(playerid, -1, tmp_str);
}
return true;
}
YCMD:afk(playerid, params[], help)
{
if(Group_GetPlayer(Group_AFK, playerid))
{
Group_SetPlayer(Group_AFK, playerid, false);
SendClientMessage(playerid, -1, "Vocк nгo esta mais afk.");
}
else
{
Group_SetPlayer(Group_AFK, playerid, true);
SendClientMessage(playerid, -1, "Agora vocк esta ausente.");
Player_TimeAfk[playerid] = gettime();
}
return true;
}
/*
# d88888b d8b db d8888b. .d88b. d88888b d88888b d888888b db d88888b
# 88' 888o 88 88 `8D .8P Y8. 88' 88' `88' 88 88'
# 88ooooo 88V8o 88 88 88 88 88 88ooo 88ooo 88 88 88ooooo
# 88~~~~~ 88 V8o88 88 88 88 88 88~~~ 88~~~ 88 88 88~~~~~
# 88. 88 V888 88 .8D `8b d8' 88 88 .88. 88booo. 88.
# Y88888P VP V8P Y8888D' `Y88P' YP YP Y888888P Y88888P Y88888P
*/