FAST QUESTION ! REP ++ ! HELP WITH DIALOG!
#1

How to make a dialog which identificates what case is clicked what row , i mean , my bug is , on every row i click it's showing me the first result who appears in dialog which is incorrect , because i have a list with wanted players and if i click one of them , it appears a style msgbox who should show the wanted level for the clicked player but if the first player (first row ) has wanted 6 , every players appears with wanted 6 in msgbox.
Reply
#2

Are you using listitem?
Reply
#3

I am using something like this:
pawn Код:
if(dialogid == 1155)
    {
        if(!response)return 1;
        // here comes my code
    }
Reply
#4

Here's an example from the wiki:

pawn Код:
#define DIALOG_WEAPONS 3
 
// In some command
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close");
 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_WEAPONS)
    {
        if(response) // If they clicked 'Select' or double-clicked a weapon
        {
            // Give them the weapon
            switch(listitem)
            {
                case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
                case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
                case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
            }
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
 
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
That should help you out.
Reply
#5

But on every item i click it's showing the value of the first, the values are showed with style_msgbox.
I don't want to make with listitem , i want that the response identificate the clicked row.
And the command for wanted is:
pawn Код:
CMD:wanted(playerid, params[])
{
    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1)
    {
        new szString[500], name[24], title[128], ee[50];
        new l=0;
        for(new i = 0; i < MAX_PLAYERS; i ++)
        {
            if(IsPlayerConnected(i))
            {
                if(playerVariables[i][pWarrants] >= 1)
                {
                    l++;
                    GetPlayerName(i, name, 24);
                    format(title,  sizeof(title),"Wanted Players: %d",l);
                    format(ee, sizeof (ee), "[W:%d][ID:%d][%.0f meters]%s\n",playerVariables[i][pWarrants],i,GetDistanceBetweenPlayers(playerid, i),GetName(i));
                    strcat(szString, ee);
                }
            }
        }
        if(l == 0) return SCM(playerid, COLOR_WHITE, "Niciun player nu are wanted in acest moment.");
        ShowPlayerDialog(playerid,1155,DIALOG_STYLE_LIST,title,szString,"Find", "Close");
    }
    else return SCM(playerid, COLOR_WHITE, "You are not in a department to use this command.");
    return 1;
}
Reply
#6

you should use listitem to detect on which row is clicked, and you'll need one array that holds player id for each row
Reply
#7

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
you should use listitem to detect on which row is clicked, and you'll need one array that holds player id for each row
Give me an example please.
Reply
#8

is this per player, or its global?

Is list that shows same for every player or not
Reply
#9

Is per player.
EDIT: I am working at a message reading system when clicking the message.
Reply
#10

I'll do it when I get back home, currently I'm @ work (taking little break)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)