FAST QUESTION ! REP ++ ! HELP WITH DIALOG! -
buburuzu19 - 24.11.2014
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.
Re: FAST QUESTION ! REP ++ -
Luis- - 24.11.2014
Are you using
listitem?
Re: FAST QUESTION ! REP ++ -
buburuzu19 - 24.11.2014
I am using something like this:
pawn Код:
if(dialogid == 1155)
{
if(!response)return 1;
// here comes my code
}
Re: FAST QUESTION ! REP ++ -
Luis- - 24.11.2014
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.
Re: FAST QUESTION ! REP ++ -
buburuzu19 - 24.11.2014
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;
}
Re: FAST QUESTION ! REP ++ -
CoaPsyFactor - 24.11.2014
you should use listitem to detect on which row is clicked, and you'll need one array that holds player id for each row
Re: FAST QUESTION ! REP ++ -
buburuzu19 - 24.11.2014
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.
Re: FAST QUESTION ! REP ++ ! HELP WITH DIALOG! -
CoaPsyFactor - 24.11.2014
is this per player, or its global?
Is list that shows same for every player or not
Re: FAST QUESTION ! REP ++ ! HELP WITH DIALOG! -
buburuzu19 - 24.11.2014
Is per player.
EDIT: I am working at a message reading system when clicking the message.
Re: FAST QUESTION ! REP ++ ! HELP WITH DIALOG! -
CoaPsyFactor - 24.11.2014
I'll do it when I get back home, currently I'm @ work (taking little break)