SA-MP Forums Archive
[AJUDA] Ajuda ae *-* - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Ajuda ae *-* (/showthread.php?tid=245990)

Pages: 1 2


[AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

Eu to fazendo um sistema pra kikar um player por causa do ping.

Coloquei dessa forma no GM

pawn Код:
public PING(playerid)
{
    if((GetPlayerPing(playerid) >= 600 && GetPlayerPing(playerid) != 65535))
    {
    SendClientMessage(playerid,COLOR_RED," Seu PING estб maior ou igual а 600.");
    SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
    }
    if((GetPlayerPing(playerid) >= 800 && GetPlayerPing(playerid) != 65535))
    {
    SendClientMessage(playerid,COLOR_RED," Seu PING continua subindo ! Tente ajeitar sua conexгo.");
    SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
    }
    if((GetPlayerPing(playerid) >= 1000 && GetPlayerPing(playerid) != 65535))
    {
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof (playername))
    SendClientMessage(playerid,COLOR_RED," Vocк foi kickado pelo servidor, pois seu PING atingiu 1000."); //LINHA 5282
    SendClientMessage(playerid,COLOR_RED," Isto й uma forma de evitar que o servidor fique com LAG.");
    SendClientMessageToAll(TEAM_ADMIN_COLOR, "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);//LINHA 5284
    Kick(playerid);
    }
    return 1;
}
Mas ta dando erro:

pawn Код:
(5282) : error 001: expected token: ";", but found "-identifier-"
(5284) : warning 202: number of arguments does not match definition



Re: [AJUDA] Ajuda ae *-* - rjjj - 02.04.2011

Isto deve resolver o seu problema, uma das linhas estava com ausкncia de uma semicolon (parte da sintaxe do cуdigo) .

pawn Код:
public PING(playerid)
{
    if((GetPlayerPing(playerid) >= 600 && GetPlayerPing(playerid) != 65535))
    {
        SendClientMessage(playerid,COLOR_RED," Seu PING estб maior ou igual а 600.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
    }
    if((GetPlayerPing(playerid) >= 800 && GetPlayerPing(playerid) != 65535))
    {
        SendClientMessage(playerid,COLOR_RED," Seu PING continua subindo ! Tente ajeitar sua conexгo.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
    }
    if((GetPlayerPing(playerid) >= 1000 && GetPlayerPing(playerid) != 65535))
    {
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);//Faltou uma parte da sintaxe do cуdigo, o semicolon.
        SendClientMessage(playerid,COLOR_RED," Vocк foi kickado pelo servidor, pois seu PING atingiu 1000."); //LINHA 5282
        SendClientMessage(playerid,COLOR_RED," Isto й uma forma de evitar que o servidor fique com LAG.");
        SendClientMessageToAll(TEAM_ADMIN_COLOR, "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);//LINHA 5284
        Kick(playerid);
    }
    return 1;
}

Espero ter ajudado .


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

Pronto a linha 5282 (a que vocк corrigiu) agora nao deu erro

Mas a 5284 ta dando o mesmo erro:

(5284) : warning 202: number of arguments does not match definition


pawn Код:
SendClientMessageToAll(TEAM_ADMIN_COLOR, "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);



Re: [AJUDA] Ajuda ae *-* - LuxurioN™ - 02.04.2011

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
Pronto a linha 5282 (a que vocк corrigiu) agora nao deu erro

Mas a 5284 ta dando o mesmo erro:

(5284) : warning 202: number of arguments does not match definition


pawn Код:
SendClientMessageToAll(TEAM_ADMIN_COLOR, "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);
Код:
new string[ 128 ];

format(string, sizeof( string ), "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);
SendClientMessageToAll(TEAM_ADMIN_COLOR, string);
SAMP Wiki - SendClientMessageToAll


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

funfou =D vlw ... mas pra q serve esse ngc de:

pawn Код:
new string[128];
e como eu sei qnd colocar e o numero q eu devo colocar dentro das "[ ]"


Re: [AJUDA] Ajuda ae *-* - LuxurioN™ - 02.04.2011

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
funfou =D vlw ... mas pra q serve esse ngc de:

pawn Код:
new string[128];
e como eu sei qnd colocar e o numero q eu devo colocar dentro das "[ ]"
"string" й a variбvel aonde vocк irб "guardar" algo (memуria), no caso acima, sua frase, para que a mesma seja executada pela funзгo na qual foi chamada (Frases com parte ainda nгo construнdas, no caso, o nome do jogador). Jб o nъmero, й o tamanho, й o nъmero de cйlulas. Deve-se ao tamanho do nъmero de caracteres que serб guardado. Na frase, temos 55 caracteres + 24(Nome do Jogador) + 1 (Caracter Nъlo). Temos 80 cйlulas, da qual seria o tamanho de nossa string. Usa-se 128 na maioria das vezes por ser o nъmero mбximo de caracteres aceito pelo Chat SA-MP.


Re: [AJUDA] Ajuda ae *-* - rjjj - 02.04.2011

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
pawn Код:
new string[128];
e como eu sei qnd colocar e o numero q eu devo colocar dentro das "[ ]"
Basta ler a parte de Arrays, que estб no final deste Tutorial :


https://sampforum.blast.hk/showthread.php?tid=235924


Espero ter ajudado .


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

Mas tem um problema ...

Eu to testando aqui sozinho na minha net

Entao eu mudei o valor pra 1, logo se o ping foi >= 1 deveria aparecer esse aviso mas num ta mostrando

:/


Re: [AJUDA] Ajuda ae *-* - LuxurioN™ - 02.04.2011

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
Mas tem um problema ...

Eu to testando aqui sozinho na minha net

Entao eu mudei o valor pra 1, logo se o ping foi >= 1 deveria aparecer esse aviso mas num ta mostrando

:/
Uma pergunta, hб um temporizador checando esta callback? Em outras palavras, existe um "timer" checando seu ping dentro de um determinado intervalo de tempo?


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

eh ... n

como q faz isso ?


Re: [AJUDA] Ajuda ae *-* - Macintosh - 02.04.2011

pawn Code:
public OnGameModeInit()
{
 SetTimer("PING",1000,false); // 1000ms = 1s , entгo irб fazer a checagem a cada 1s para ver se o ping estб acima do permitido.
 return 1;
}
https://sampwiki.blast.hk/wiki/SetTimer


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

Ok. Deixa eu testar


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

So deu um problema agora:

(5295) : warning 209: function "PING" should return a value

pawn Code:
public PING(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if((GetPlayerPing(playerid) >= 600 && GetPlayerPing(playerid) != 65535))
        {
        SendClientMessage(playerid,COLOR_RED," Seu PING estб maior ou igual а 600.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
        }
        if((GetPlayerPing(playerid) >= 800 && GetPlayerPing(playerid) != 65535))
        {
        SendClientMessage(playerid,COLOR_RED," Seu PING continua subindo ! Tente ajeitar sua conexгo.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
        }
        if((GetPlayerPing(playerid) >= 1000 && GetPlayerPing(playerid) != 65535))
        {
        new playername[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid, playername, sizeof (playername));
        SendClientMessage(playerid,COLOR_RED," Vocк foi kickado pelo servidor, pois seu PING atingiu 1000.");
        SendClientMessage(playerid,COLOR_RED," Isto й uma forma de evitar que o servidor fique com LAG.");
        format(string, sizeof(string), "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);
        SendClientMessageToAll(TEAM_ADMIN_COLOR, string);
        Kick(playerid);
        }
        return 1;
    }
}
Faзo oq ?


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

Alguem ?


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

Alguem pode me ajudar ae ? So falta isso pra compilar o gm ...


Re: [AJUDA] Ajuda ae *-* - Diogo_Bras - 02.04.2011

Dб erro? Por acaso no topo do gamemode vocк tem:
pawn Code:
forward PING(playerid);
?


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

ja aj eu ja coloquei isso ae la


Re: [AJUDA] Ajuda ae *-* - Diogo_Bras - 02.04.2011

Code:
(5295) : warning 209: function "PING" should return a value
Mande a linha.


Re: [AJUDA] Ajuda ae *-* - Shadoww5 - 02.04.2011

pawn Code:
public PING(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(GetPlayerPing(playerid) >= 600 && GetPlayerPing(playerid) != 65535)
        {
        SetTimer("PING", 5000, true);
        SendClientMessage(playerid,COLOR_RED," Seu PING estб maior ou igual а 600.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
        }
        if(GetPlayerPing(playerid) >= 800 && GetPlayerPing(playerid) != 65535)
        {
        SetTimer("PING", 1000, true);
        SendClientMessage(playerid,COLOR_RED," Seu PING continua subindo ! Tente ajeitar sua conexгo.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
        }
        if(GetPlayerPing(playerid) >= 1000 && GetPlayerPing(playerid) != 65535)
        {
        SetTimer("PING", 1000, true);
        new playername[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid, playername, sizeof (playername));
        SendClientMessage(playerid,COLOR_RED," Vocк foi kickado pelo servidor, pois seu PING atingiu 1000.");
        SendClientMessage(playerid,COLOR_RED," Isto й uma forma de evitar que o servidor fique com LAG.");
        format(string, sizeof(string), "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);
        SendClientMessageToAll(TEAM_ADMIN_COLOR, string);
        Kick(playerid);
        KickLog(string);
        }
        return 1;
    }
} //LINHA 5295



Re: [AJUDA] Ajuda ae *-* - Diogo_Bras - 02.04.2011

pawn Code:
public PING(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(GetPlayerPing(playerid) >= 600 && GetPlayerPing(playerid) != 65535)
        {
        SetTimer("PING", 5000, true);
        SendClientMessage(playerid,COLOR_RED," Seu PING estб maior ou igual а 600.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
        }
        if(GetPlayerPing(playerid) >= 800 && GetPlayerPing(playerid) != 65535)
        {
        SetTimer("PING", 1000, true);
        SendClientMessage(playerid,COLOR_RED," Seu PING continua subindo ! Tente ajeitar sua conexгo.");
        SendClientMessage(playerid,COLOR_RED," Caso ele atinga 1000 vocк serб kickado automaticamente pelo servidor.");
        }
        if(GetPlayerPing(playerid) >= 1000 && GetPlayerPing(playerid) != 65535)
        {
        SetTimer("PING", 1000, true);
        new playername[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid, playername, sizeof (playername));
        SendClientMessage(playerid,COLOR_RED," Vocк foi kickado pelo servidor, pois seu PING atingiu 1000.");
        SendClientMessage(playerid,COLOR_RED," Isto й uma forma de evitar que o servidor fique com LAG.");
        format(string, sizeof(string), "%s foi kickado pelo servidor, pois seu PING atingiu 1000.", playername);
        SendClientMessageToAll(TEAM_ADMIN_COLOR, string);
        Kick(playerid);
        KickLog(string);
        }
        }
        return 1;
}
Testado, nгo dб erro.
Conclusгo: A chave " } " para fechar o if(IsPlayerConnected(playerid)) estava depois do return 1; e eu coloquei antes.

Antes:
pawn Code:
KickLog(string);
}
return 1;
}
}
Agora:
pawn Code:
KickLog(string);
}
}
return 1;
}