[Ajuda] Kickar apуs 15 minutos.
#1

Bom, procurei diversas funзхes na SAMP wiki, mas nгo achei uma que se adaptasse a o que eu quero. O que eu quero, й poder kickar um player se ele deu o comando /afk, e em 15 minutos nгo eu o comando /sairafk. Entao se o players ficasse mais de 15min com o /afk ativado ele seria kickado, e para nгo ocorrer isto ele precisaria ter usado o /sairafk. Espero que alguйm me ajude por favor.
Reply
#2

use SetTimerEx no comando /afk voce ja tme o /afk pronto ?
Reply
#3

Quote:
Originally Posted by BreakDriFT
Посмотреть сообщение
use SetTimerEx no comando /afk voce ja tme o /afk pronto ?
Sim. Estб ae:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp("/afk", cmdtext, true) == 0)
   {
   if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
   else SendClientMessage(playerid, COR_AZUL, "Vocк estб AFK, digite /sairafk quando voltar!");
   TogglePlayerControllable(playerid,0);
   label[playerid] = Create3DTextLabel("Player AFK!",COR_VERMELHO2,30.0,40.0,50.0,40.0,0);
   Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
   ApplyAnimation(playerid,"BEACH","ParkSit_M_loop",2.0, 1, 0, 0, 0, 0);
   new string3[70];
   new name[MAX_PLAYER_NAME];
   GetPlayerName(playerid, name, sizeof(name));

   format(string3, sizeof(string3), "%s(%d) ficou AFK!", name, playerid);
   SendClientMessageToAll(COR_AZUL, string3);
   }
Se precisar do /sairafk tbm fala.
Reply
#4

pawn Код:
forward KickAfk(playerid)
new bool:afk[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp("/afk", cmdtext, true) == 0)
   {
   if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
   else SendClientMessage(playerid, COR_AZUL, "Vocк estб AFK, digite /sairafk quando voltar!");
   TogglePlayerControllable(playerid,0);
   label[playerid] = Create3DTextLabel("Player AFK!",COR_VERMELHO2,30.0,40.0,50.0,40.0,0);
   Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
   ApplyAnimation(playerid,"BEACH","ParkSit_M_loop",2.0, 1, 0, 0, 0, 0);
   afk[playerid] = true;
   new string3[70];
   new name[MAX_PLAYER_NAME];
   GetPlayerName(playerid, name, sizeof(name));

   format(string3, sizeof(string3), "%s(%d) ficou AFK!", name, playerid);
   SendClientMessageToAll(COR_AZUL, string3);
   }

public KickAfk(playerid)
{
    if(afk[playerid] == true)
    {
    Kick(playerid);
    }
    return 1;
}
Agora faзa o Timer
Reply
#5

Quote:
Originally Posted by BreakDriFT
Посмотреть сообщение
pawn Код:
forward KickAfk(playerid)
new bool:afk[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp("/afk", cmdtext, true) == 0)
   {
   if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
   else SendClientMessage(playerid, COR_AZUL, "Vocк estб AFK, digite /sairafk quando voltar!");
   TogglePlayerControllable(playerid,0);
   label[playerid] = Create3DTextLabel("Player AFK!",COR_VERMELHO2,30.0,40.0,50.0,40.0,0);
   Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
   ApplyAnimation(playerid,"BEACH","ParkSit_M_loop",2.0, 1, 0, 0, 0, 0);
   afk[playerid] = true;
   new string3[70];
   new name[MAX_PLAYER_NAME];
   GetPlayerName(playerid, name, sizeof(name));

   format(string3, sizeof(string3), "%s(%d) ficou AFK!", name, playerid);
   SendClientMessageToAll(COR_AZUL, string3);
   }

public KickAfk(playerid)
{
    if(afk[playerid] == true)
    {
    Kick(playerid);
    }
    return 1;
}
Agora faзa o Timer
vocк nгo precisa de definir publics, sу de fazer KillTimer faz o trabalho
Reply
#6

Quote:
Originally Posted by BreakDriFT
Посмотреть сообщение
pawn Код:
forward KickAfk(playerid)
new bool:afk[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp("/afk", cmdtext, true) == 0)
   {
   if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
   else SendClientMessage(playerid, COR_AZUL, "Vocк estб AFK, digite /sairafk quando voltar!");
   TogglePlayerControllable(playerid,0);
   label[playerid] = Create3DTextLabel("Player AFK!",COR_VERMELHO2,30.0,40.0,50.0,40.0,0);
   Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
   ApplyAnimation(playerid,"BEACH","ParkSit_M_loop",2.0, 1, 0, 0, 0, 0);
   afk[playerid] = true;
   new string3[70];
   new name[MAX_PLAYER_NAME];
   GetPlayerName(playerid, name, sizeof(name));

   format(string3, sizeof(string3), "%s(%d) ficou AFK!", name, playerid);
   SendClientMessageToAll(COR_AZUL, string3);
   }

public KickAfk(playerid)
{
    if(afk[playerid] == true)
    {
    Kick(playerid);
    }
    return 1;
}
Agora faзa o Timer
Vlw cara. Fiz o timer aqui funcionou certinho. Dъvida resolvida. =]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)