[AFK List] Support needed if poss
#1

Hi,

How would i create an AFK List for Ravens script? Anybody know a command to show people who are on "/afk"?

Thanks
Reply
#2

Maybe you are looking for this?
[FilterScript] AFK-System + AFK-List from Homie_MH
Reply
#3

Quote:
Originally Posted by nepstep
Посмотреть сообщение
Maybe you are looking for this?
[FilterScript] AFK-System + AFK-List from Homie_MH
Thank's for heads up, That doesn't work with Ravens though.
Reply
#4

Then maybe
[FilterScript] AFK System by ~Ricky~
Reply
#5

That mite work,

My vairable is AFK[playerid] = 1;

What would I change if(AFK[i] == 1) to?
Reply
#6

Probably [i] stands for a loop(or foreach) integer so its for every online player, probably for the AFK list.
[playerid] should be putted only when a player defines if is afk or not.
I suggest you to use one of those filterscripts as they are and remove any AFK variable from your gamemode, like own afk systems and stuff.
Try it and it should work.
Reply
#7

Just tried

Код:
C:\Users\matthew\Desktop\New Generation LS;RP 2012 Server\filterscripts\afk.pwn(42) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\matthew\Desktop\New Generation LS;RP 2012 Server\filterscripts\afk.pwn(56) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Код:
#include <a_samp>

new AFK[MAX_PLAYERS];
new Text3D:AFKL[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	AFK[playerid] = 0;
	return 1;
}

public OnPlayerDisconnect(playerid)
{
    Delete3DTextLabel(AFKL[playerid]);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new string[256];

	if (strcmp("/afklist", cmdtext, true) == 0)
	{
			SendClientMessage(playerid, 0x33AA33AA, "AFK LIST:");
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
				    if(AFK[i] == 1)
				    {
         					new name[128];
							GetPlayerName(i,name,128);
							format(string, 256, "%s", name);
							SendClientMessage(playerid, 0xFFFF00FF, string);
					}
				}
			}
			return 1;
	}
    if(!strcmp(cmdtext, "/imafk", true))
    {
	    new string[128], name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You are already AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 1;
	    TogglePlayerControllable(playerid, 0);
	    SendClientMessage(playerid, 0x33AA33AA, "You are now AFK, When you are back type /back!");
	    format(string, sizeof string, "%s is now AFK!", name);
	    SendClientMessageToAll(0xAFAFAFAA, string);
        AFKL[playerid] = Create3DTextLabel("Away From Keyboard", 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(AFKL[playerid], playerid, 0.0, 0.0, 0.7);
	    return 1;
    }
    if(!strcmp(cmdtext, "/back", true))
    {
	    new string[128], name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You aren't AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 0;
	    TogglePlayerControllable(playerid, 1);
        SendClientMessage(playerid, 0x33AA33AA, "You are back!");
        format(string, sizeof string, "%s is back!", name);
	    SendClientMessageToAll(0xAFAFAFAA, string);
        Delete3DTextLabel(AFKL[playerid]);
	    return 1;
    }
    return 0;
}
Reply
#8

There you go
pawn Код:
#include <a_samp>

new AFK[MAX_PLAYERS];
new Text3D:AFKL[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    AFK[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    Delete3DTextLabel(AFKL[playerid]);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];

    if (strcmp("/afklist", cmdtext, true) == 0)
    {
            SendClientMessage(playerid, 0x33AA33AA, "AFK LIST:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(AFK[i] == 1)
                    {
                            new name[128];
                            GetPlayerName(i,name,128);
                            format(string, 256, "%s", name);
                            SendClientMessage(playerid, 0xFFFF00FF, string);
                    }
                }
            }
            return 1;
    }
    if(!strcmp(cmdtext, "/imafk", true))
    {
        new name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You are already AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 1;
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, 0x33AA33AA, "You are now AFK, When you are back type /back!");
        format(string, sizeof string, "%s is now AFK!", name);
        SendClientMessageToAll(0xAFAFAFAA, string);
        AFKL[playerid] = Create3DTextLabel("Away From Keyboard", 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(AFKL[playerid], playerid, 0.0, 0.0, 0.7);
        return 1;
    }
    if(!strcmp(cmdtext, "/back", true))
    {
        new name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You aren't AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 0;
        TogglePlayerControllable(playerid, 1);
        SendClientMessage(playerid, 0x33AA33AA, "You are back!");
        format(string, sizeof string, "%s is back!", name);
        SendClientMessageToAll(0xAFAFAFAA, string);
        Delete3DTextLabel(AFKL[playerid]);
        return 1;
    }
    return 0;
}
Goodluck & Goodnight from me, I'm off for today
Reply
#9

Quote:
Originally Posted by nepstep
Посмотреть сообщение
There you go
pawn Код:
#include <a_samp>

new AFK[MAX_PLAYERS];
new Text3D:AFKL[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    AFK[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    Delete3DTextLabel(AFKL[playerid]);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];

    if (strcmp("/afklist", cmdtext, true) == 0)
    {
            SendClientMessage(playerid, 0x33AA33AA, "AFK LIST:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(AFK[i] == 1)
                    {
                            new name[128];
                            GetPlayerName(i,name,128);
                            format(string, 256, "%s", name);
                            SendClientMessage(playerid, 0xFFFF00FF, string);
                    }
                }
            }
            return 1;
    }
    if(!strcmp(cmdtext, "/imafk", true))
    {
        new name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You are already AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 1;
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, 0x33AA33AA, "You are now AFK, When you are back type /back!");
        format(string, sizeof string, "%s is now AFK!", name);
        SendClientMessageToAll(0xAFAFAFAA, string);
        AFKL[playerid] = Create3DTextLabel("Away From Keyboard", 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(AFKL[playerid], playerid, 0.0, 0.0, 0.7);
        return 1;
    }
    if(!strcmp(cmdtext, "/back", true))
    {
        new name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You aren't AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 0;
        TogglePlayerControllable(playerid, 1);
        SendClientMessage(playerid, 0x33AA33AA, "You are back!");
        format(string, sizeof string, "%s is back!", name);
        SendClientMessageToAll(0xAFAFAFAA, string);
        Delete3DTextLabel(AFKL[playerid]);
        return 1;
    }
    return 0;
}
Goodluck & Goodnight from me, I'm off for today
Thankyou for that, I removed the old afk system from ravens and put this one in, Much better!

Thanks
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)