AFk list code
#1

Код:
COMMAND:afklist(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128];
        new IsAfkPlayer[MAX_PLAYER_NAME];
  		SendClientMessage(playerid, COLOR_GREEN, " ");
        SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________");
		SendClientMessage(playerid, COLOR_GREEN, " ");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
	 		if (IsPlayerConnected(i))
 			{
				if(IsAfk[playerid] == 1)
				{
				    GetPlayerName(IsAfk[playerid],IsAfkPlayer,sizeof(IsAfkPlayer));
					format(string, "AFK: %s",IsAfkPlayer);
					SendClientMessage(playerid, COLOR_WHITE, string);
					count++;
				}
			}
		}
		if (count == 0)
		SendClientMessage(playerid,COLOR_BRIGHTRED,"No one is AFK here buddy.");
		SendClientMessage(playerid, COLOR_GREEN, " _______________________________________");
		return 1;
}
May i know why is there a argument mismatch?

Idk :S
Reply
#2

Which line has the ' argument type mismatch ' warning ?
Reply
#3

Код:
format(string, "AFK: %s",IsAfkPlayer);
This has the argument type mismatch.
Reply
#4

format(string, 30, "AFK: %s", IsAfkPlayer);
Reply
#5

Thank you so much!
Reply
#6

Try this:

pawn Код:
// top of script:

new IsAfkPlayer[MAX_PLAYER_NAME];

// in your /afk command

IsAfkPlayer[playerid] = 1;

// command:

COMMAND:afklist(playerid,params[])
{
    #pragma unused params
    new count = 0;
    new string[128];

    SendClientMessage(playerid, COLOR_GREEN, " ");
    SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________");
    SendClientMessage(playerid, COLOR_GREEN, " ");
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsAfkPlayer[playerid] == 1)
            {
                count++;
                new name[24];
                GetPlayerName(playerid,name,24);
                format(string, "AFK PLAYERS: %s",name);
                SendClientMessage(playerid, COLOR_WHITE, string);
            }
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid,COLOR_BRIGHTRED,"No one is AFK here buddy.");
        SendClientMessage(playerid, COLOR_GREEN, " _______________________________________");
    }
    return 1;
}
Reply
#7

the problem is here -> format(string, "AFK PLAYERS: %s",name); and was already solved.
Reply
#8

Also Grand Theft -
pawn Код:
SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________");
I'm giving you a rep just for that epic fail (not being sarcastic).
Reply
#9

Quote:
Originally Posted by Pharrel
Посмотреть сообщение
the problem is here -> format(string, "AFK PLAYERS: %s",name); and was already solved.
Dragonster is in my server, and said he still had a problem with it, so I replied again.

Quote:
Originally Posted by Yamoo
Посмотреть сообщение
Also Grand Theft -
pawn Код:
SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________");
I'm giving you a rep just for that epic fail (not being sarcastic).
If you read carefully on Dragons post, it already says that line in HIS code, not only mine. Don't go around implying that people ' fail ' when you should learn to read.

Quote:
Originally Posted by Pharrel
Посмотреть сообщение
kkkkkkkkkkkkkkkk pwned!
Useless post, spammer.
Reply
#10

I'd like to point out that this line is incorrect as it'd only get player id 1's name
pawn Код:
GetPlayerName(IsAfk[playerid],IsAfkPlayer,sizeof(IsAfkPlayer));
it should be

pawn Код:
GetPlayerName( i ,IsAfkPlayer,sizeof(IsAfkPlayer));
also this line is also wrong

pawn Код:
if(IsAfk[playerid] == 1)
should be
pawn Код:
if(IsAfk[i] == 1)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)