[Ajuda] AFK inovation system.
#1

Код:
Sistema AFK by Cabelo
Um FS simples que eu editei aqui !

Comandos:
/afk
/voltar
/listafk - Ve os players que estгo no modo afk(/afk)

Linkdownload:
http://solidfiles.com/d/StS6
Eu gostaria de editar este filterscript, pondo da seguinte forma:
/afk [minutos] [razao]
* Pedro Nobre ficou 20 minutos afk, razao: Jantar.

e no final desses 20 minutos, se ele ainda nao tivesse feito o "/voltar" , era automaticamente kickado.
Podiam-me ajudar ?
Reply
#2

Tenta isso

pawn Код:
forward VoltarAFK(playerid);
new TempoAFK;
gettime(TempoAFK);

    if(strcmp(cmd, "/afk", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /afk [Minutos] [Motivo]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
             if(giveplayerid != INVALID_PLAYER_ID)
              {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USE: /afk [Minutos] [Motivo]");
                            return 1;
                        }
                        format(string, sizeof(string), "ADMIN CMD: %s Ficou AFK Por %d Minutos Motivo: %s", giveplayer, TempoAFK, sendername, (result));
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        SetTimer("VoltarAFK",TempoAFK,false);
                        return 1;
                }
            }
        }
        return 1;
    }
   
public VoltarAFK(playerid)
{
 TempoAFK = Kick(playerid);
 SendClientMessage(playerid, COLOR_WHITE, "[AVISO] Fostes kickado por exceder o tempo limite de minutos AFK!");
 return 1;
}
Reply
#3

Que massa.
sу mais uma pequena dъvida, gostava de tambem que sу os admins pudessem ver os players em "afk's".
tipo /listaafk e aparecesse os players afk com os minutos e a razao que eles puseram.
Reply
#4

pawn Код:
if (strcmp("/listafk", cmdtext, true, 10) == 0)
{
         if(IsPlayerAdmin(playerid))
         {
            SendClientMessage(playerid, 0x33CCFFAA, "Jogadores AFK:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(Afk[i]==1)
                    {
                        GetPlayerName(i, Name, sizeof(Name));
                        format(string, 256, "Jogador: %s | Tempo: %d | Motivo: %s", Name,TempoAFK,(result));
                        SendClientMessage(playerid, 0xFFFFFFAA, string);
                    }
                }
            }
         }
         return 1;
}
Reply
#5

@ Licolas
- agradeзo imenso a ajuda pela sua parte. mas dб alguns erros

Aqui estб o FS:

Код:
#include <a_samp>
forward VoltarAFK(playerid);
new TempoAFK;
gettime(TempoAFK);

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/afk", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, 0xFF0000AA, "USE: /afk [Minutos] [Motivo]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
             if(giveplayerid != INVALID_PLAYER_ID)
              {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USE: /afk [Minutos] [Motivo]");
                            return 1;
                        }
                        format(string, sizeof(string), "ADMIN CMD: %s Ficou AFK Por %d Minutos Motivo: %s", giveplayer, TempoAFK, sendername, (result));
                        SendClientMessageToAll(0xFF0000AA, string);
                        SetTimer("VoltarAFK",TempoAFK,false);
                        return 1;
                }
            }
        }
        return 1;
    }
	if (strcmp("/voltar", cmdtext, true, 10) == 0)
	{
	    if(Afk[playerid]==1){
		Afk[playerid]=0;
		Timer[playerid] = SetTimer("SendMessage",100,0);
		TogglePlayerControllable(playerid,1);
        format(string, sizeof(string), "%s voltou para o server", Name);
        SendClientMessageToAll(0x33CCFFAA, string);
		}else{SendClientMessage(playerid,0xFF0000AA, "Voltaste ao servidor, continuaзao de um Bom RP*.");}
		return 1;
	}
	if (strcmp("/listafk", cmdtext, true, 10) == 0)
    {
         if(IsPlayerAdmin(playerid))
         {
            SendClientMessage(playerid, 0x33CCFFAA, "Jogadores AFK:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(Afk[i]==1)
                    {
                        GetPlayerName(i, Name, sizeof(Name));
                        format(string, 256, "Jogador: %s | Tempo: %d | Motivo: %s", Name,TempoAFK,(result));
                        SendClientMessage(playerid, 0xFFFFFFAA, string);
                    }
                }
            }
                }
            return 1;
    }
public VoltarAFK(playerid)
{
 TempoAFK = Kick(playerid);
 SendClientMessage(playerid, 0xFF0000AA, "[AVISO] Fostes kickado por exceder o tempo limite de minutos AFK!");
 return 1;
}
Код:
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(4) : error 021: symbol already defined: "gettime"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(8) : error 017: undefined symbol "cmd"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(12) : error 017: undefined symbol "tmp"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(12) : error 017: undefined symbol "strtok"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(13) : error 017: undefined symbol "tmp"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(18) : error 017: undefined symbol "giveplayerid"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(18) : error 017: undefined symbol "ReturnUser"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(19) : error 017: undefined symbol "giveplayerid"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(21) : error 017: undefined symbol "giveplayerid"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(23) : error 017: undefined symbol "giveplayerid"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(23) : error 017: undefined symbol "giveplayer"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(23) : error 029: invalid expression, assumed zero
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(23) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


13 Errors.
Reply
#6

pawn Код:
new cmd[256];
new tmp[256];
new giveplayer[MAX_PLAYER_NAME];
new giveplayerid;
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#7

pawn Код:
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(6) : error 021: symbol already defined: "gettime"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(35) : error 017: undefined symbol "idx"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(41) : error 017: undefined symbol "ReturnUser"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(47) : error 017: undefined symbol "sendername"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(47) : error 017: undefined symbol "sendername"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(47) : error 029: invalid expression, assumed zero
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(47) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Reply
#8

Apague a linha 6 ._.
Reply
#9

pawn Код:
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(43) : error 017: undefined symbol "ReturnUser"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(65) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(68) : error 017: undefined symbol "string"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(68) : error 017: undefined symbol "string"
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(68) : error 029: invalid expression, assumed zero
C:\Users\Pedro Nobre\Desktop\sistafk.pwn(68) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
tб quase xD, ajude-me mais um pouco :b
Reply
#10

pawn Код:
new sendername[MAX_PLAYER_NAME];
new idx;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)