09/10/2023 16:34
(Esta mensagem foi modificada pela última vez a: 09/10/2023 21:06 por leonardos08bt.)
Código:
Se esse for o problema..
no dialog response adicione o "istitem+1", isso deve resolver o problema, mas o listitem começa do 0 então é meio estranho isso..
Código:
new showcontract[MAX_PLAYERS][MAX_PLAYERS]; // 1º parametro = playerid | 2º parametro = listitem
CMD:teste(playerid)
{
new megastring[2000], string[256], cont = 0;
format(string, sizeof(string), " \tOrganização:\n");
strcat(megastring, string);
for(new i = 0; i < MAX_PLAYERS; i++) //Use foreach para otimizar o loop.
{
if(!IsPlayerConnected(i))
continue;
if(PlayerInfo[i][pHeadValue] > 0) {
showcontract[playerid][i] = i; //Se tiver sistema de ID FIXO, o valor que a variavel vai receber deve ser o ID FIXO do "i" (facilita muito mais na hora de encontrar o pj).
cont ++;
if(gTeam[i] == 0) {
format(string, sizeof(string), "%s(%d) - $%d\n", Name(i), i, PlayerInfo[i][pHeadValue]);
strcat(megastring, string);
}
else {
format(string, sizeof(string), "%s(%d) - $%d\t(%s)\n", Name(i), i, PlayerInfo[i][pHeadValue], TeamName(gTeam[i]));
strcat(megastring, string);
}
FORMAT_SSTR "%s", TeamName(gTeam[playerid]));
}
}
if(cont) return ShowPlayerDialog(playerid, DIALOG_ASSASSINOS_4, DIALOG_STYLE_TABLIST_HEADERS, sstring, megastring, "Fechar", "");
else return SCM(playerid, 0xFF0000FF, "Erro: {FFFFFF}Nao ha contratos online.");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_ASSASSINOS_4:
{
if(response) {
FORMAT_STR "[DEBUG]: %s", Name(showcontract[playerid][listitem]));
SCM(playerid, -1, string);
}
return 1;
}
}
return 1;
}
(09/10/2023 16:30)L10motos Escreveu: Tipo, eu clico no jogador 4, aparece que eu cliquei no jogador 3, eu clico no jogador 3, aparece que eu cliquei no jogador 2 sendo que cliquei no jogador 3.
Se esse for o problema..
no dialog response adicione o "istitem+1", isso deve resolver o problema, mas o listitem começa do 0 então é meio estranho isso..