[AJUDA] Comando - 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] Comando (
/showthread.php?tid=323817)
[AJUDA] Comando -
rafinha.faria - 07.03.2012
Tem algum comando/tag no pawno q retorna o id do player
tipo
Код:
if(i == GetPlayerID(nome/ou seila oq);
Re: [AJUDA] Comando -
DarkScripter - 07.03.2012
Returna o id do player.
Caso nгo tenha o "playerid" na callback,
faзa um loop:
pawn Код:
for(new i; i != MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i))
{
printf("ID: %i", i);
}
}
Re: [AJUDA] Comando -
rafinha.faria - 07.03.2012
Entendi.. tipo pode me ajudar??
Peguei esse sistema aki no forum, Link original:
https://sampforum.blast.hk/showthread.php?tid=311389
ai fiz umas modificaзoes para q mostrasse o 1є 2є e 3є .. ficou assim:
Код:
stock TopPlayersOnline(playerid)
{
#pragma unused playerid
new string[256],stringS[256],stringT[256];
while(Percorrido < 10) {
for(new pp; pp < GetMaxPlayers(); pp++) if(IsPlayerConnected(pp))
{
if(GetPlayerScore(pp) > Valor_Maximo[Percorrido]) //<<<<<<<<<<<<<<<<<<
{
GetPlayerName(pp,PlayerMelhor[Percorrido],24);
Valor_Maximo[Percorrido] = GetPlayerScore(pp);
}
for(new ss; ss < GetMaxPlayers(); ss++) if(IsPlayerConnected(ss))
{
if (ss == GetPlayerID(PlayerMelhor[pp],1)) continue; // A minha intenзгo й q quando a Var "SS" for
o valor do primeiro, ela pula ele, pra nao
aparecer duas vezes =(
if(Valor_Maximo[ss] > SegundoValor_Maximo[Percorrido]) // <<<<<<<<<<<<<<<<
{
GetPlayerName(ss,SegundoMelhor[Percorrido],24);
SegundoValor_Maximo[Percorrido] = GetPlayerScore(ss);
}
for(new tt; tt < GetMaxPlayers(); tt++) if(IsPlayerConnected(tt))
{
if (tt == GetPlayerID(PlayerMelhor[pp],1)) continue;
if (tt == GetPlayerID(SegundoMelhor[ss],1)) continue;
if(SegundoValor_Maximo[tt] > TerceiroValor_Maximo[Percorrido]) // <<<<<<<<<
{
GetPlayerName(tt,TerceiroMelhor[Percorrido],24);
TerceiroValor_Maximo[Percorrido] = GetPlayerScore(tt);
}
TopFoi[pp] = true;
}
}
}
Percorrido++;
}
for(new a; a < 500; a++) if(IsPlayerConnected(a)) TopFoi[a] = false;
Percorrido = 0;
for(new i; i < GetMaxPlayers();i++)
{
if(PlayerMelhor[i][0] != EOS)
{
format(string ,64,"~r~1 - ~w~%s - ~b~%d",PlayerMelhor[i],Valor_Maximo[i]);
TextDrawSetString(trank,string);
TextDrawShowForAll(trank);
}
if(SegundoMelhor[i][0] != EOS)
{
format(stringS ,64,"~r~2 - ~w~%s - ~b~%d",SegundoMelhor[i],SegundoValor_Maximo[i]);
TextDrawSetString(trankk,stringS);
TextDrawShowForAll(trankk);
}
if(TerceiroMelhor[i][0] != EOS)
{
format(stringT ,64,"~r~3 - ~w~%s - ~b~%d",TerceiroMelhor[i],TerceiroValor_Maximo[i]);
TextDrawSetString(trankkk,stringT);
TextDrawShowForAll(trankkk);
}
Valor_Maximo[i] = -1;
SegundoValor_Maximo[i] = -1;
TerceiroValor_Maximo[i] = -1;
}
}
sу q tipo ta bugando no server... vira uma confusгo sу... as vezes fica os tres mostrando o mesmo player.. as vezes muda tudo as posiзoes.. vixi... ta um caos
Re: [AJUDA] Comando -
DarkScripter - 07.03.2012
Olhe o tutorial da Caroline, lб ensina hб fazer Ranking.