[AJUDA]Erro no /listaway
#1

coloquei no comeзo do gm:
pawn Код:
new parafk;
No onplayercommandtext:
pawn Код:
if(strcmp(cmd, "/afk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(parafk == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб afk.", sendername);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid,0);
SetPlayerHealth(playerid, 9999);
PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
SetPlayerVirtualWorld(playerid, 1);
return 1;
}
return 1;
}

if(strcmp(cmd, "/sairafk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(parafk == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s voltou para o servidor.", sendername);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid,1);
SetPlayerHealth(playerid, 100);
PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
return 1;
}

if(strcmp(cmd, "/listaway", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(parafk == 1)
{
SendClientMessage(COLOR_LIGHTBLUE,"Jogadores Away:");
format(string, sizeof(string), "Jogador: %s.", sendername);
SendClientMessage(COLOR_WHITE, string);
return 1;
}
return 1;
}
o que estб errado ai? ja tentei arrumar de todas as formas, to usando o GM BrC como estudo derivado do Thug e talz, e da erro no GM no GivePlayerMoneyEx (nadave) alguйm pode ajudaa?
Reply
#2

Faz um Loop.
Reply
#3

Tenta isso
pawn Код:
if(strcmp(cmd, "/afk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб afk.", sendername);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid,0);
SetPlayerHealth(playerid, 9999);
PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
SetPlayerVirtualWorld(playerid, 1);
parafk = 1;
return 1;
}
return 1;
}

if(strcmp(cmd, "/sairafk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s voltou para o servidor.", sendername);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid,1);
SetPlayerHealth(playerid, 100);
PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
SetPlayerVirtualWorld(playerid, 0);
parafk = 0;
return 1;
}
return 1;
}

if(strcmp(cmd, "/listaway", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(parafk == 1)
{
SendClientMessage(COLOR_LIGHTBLUE,"Jogadores Away:");
format(string, sizeof(string), "Jogador: %s.", sendername);
SendClientMessage(COLOR_WHITE, string);
return 1;
}
return 1;
}
Reply
#4

Pronto arrumei pra vocК =)
Tб identado e talz, fiz agora.
Testa ae,.
pawn Код:
new PlayerAfk[MAX_PLAYERS];

if(strcmp(cmd, "/afk", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerAfk[playerid] == 0)
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s estб afk.", sendername);
            SendClientMessageToAll(COLOR_LIGHTBLUE, string);
            TogglePlayerControllable(playerid,0);
            SetPlayerHealth(playerid, 9999);
            PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
            SetPlayerVirtualWorld(playerid, 1);
            PlayerAfk[playerid] = 1;
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "Vocк jб estб AFK.");
            return 1;
        }
    }
    return 1;
}
if(strcmp(cmd, "/sairafk", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerAfk[playerid] == 1)
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s voltou para o servidor.", sendername);
            SendClientMessageToAll(COLOR_LIGHTBLUE, string);
            TogglePlayerControllable(playerid,1);
            SetPlayerHealth(playerid, 100);
            PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
            SetPlayerVirtualWorld(playerid, 0);
            PlayerAfk[playerid] = 0;
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "Vocк nгo estб AFK.");
            return 1;
        }
    }
    return 1;
}

if(strcmp(cmd, "/listaway", true) == 0)
{
    for(new i=0; i<MAX_PLAYERS; ++i)
    {
        if(PlayerAfk[i] == 1)
        {
            SendClientMessage(COLOR_LIGHTBLUE,"--- Jogadores Away: -----");
            format(string, sizeof(string), "JogadorID: %d.", i);
            SendClientMessage(COLOR_WHITE, string);
            return 1;
        }
        return 1;
    }
}
Reply
#5

Quote:
Originally Posted by GuikBretas
Посмотреть сообщение
Tenta isso
pawn Код:
if(strcmp(cmd, "/afk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб afk.", sendername);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid,0);
SetPlayerHealth(playerid, 9999);
PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
SetPlayerVirtualWorld(playerid, 1);
parafk = 1;
return 1;
}
return 1;
}

if(strcmp(cmd, "/sairafk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s voltou para o servidor.", sendername);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid,1);
SetPlayerHealth(playerid, 100);
PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
SetPlayerVirtualWorld(playerid, 0);
parafk = 0;
return 1;
}
return 1;
}

if(strcmp(cmd, "/listaway", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(parafk == 1)
{
SendClientMessage(COLOR_LIGHTBLUE,"Jogadores Away:");
format(string, sizeof(string), "Jogador: %s.", sendername);
SendClientMessage(COLOR_WHITE, string);
return 1;
}
return 1;
}
Invйs de
pawn Код:
new parafk;
Coloque
pawn Код:
new parafk[MAX_PLAYERS];
Reply
#6

O cуdigo jб estб pronto, sу pegar o meu..
E nгo й sу mudar new paraafk.
Reply
#7

Pow tem esse cуdigo todo ai em cуdigos utйis senгo me foge a memуria.. nгo precisa ficar postando...
Usa o search antes de vim postar aki...

@OFF
Era bem melhor se o cara pudesse criar um topico com a TAG dъvida quando sу usasse o search...
Reply
#8

Deixa ele tentar fazer o cуdigo, aprender e fazer duvidas
Melhor do que pegar um cуdigo jб pronto.
Alн pelo menos ele "aprendeu"
Reply
#9

@Ricop
Cara,alйm de seu cod estб todo errado, esse
pawn Код:
if(PlayerAfk[i] == 1)
tб execultando duas funзхes, sу pode dar /listaway quem tiver afk, eu jб arrumei, mais obrigado a quem tentou me ajudar.

Abraзos.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)