Dialog -
RedCounty - 19.11.2013
Hello,
I have a question for you all. How could I possible do something like this:
If a player types /bank, then it shows "Withdraw\nDeposit\nTransfer", then I did this:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "%s%s\n", string, GetName);
}
}
ShowPlayerDialog(playerid, DIALOG_TRANSFER, DIALOG_STYLE_LIST, "Transfer", string, "Transfer", "");
How could it grab the ID from the dialog?
EG: If there was this:
player1
player2
player3
player10
If playerid's 4, 5, 6, 7, 8 and 9 aren't connected, and I wanted player10, which was id 10, how could I grab the ID?
Because it would usually be:
for the ID's, but that won't work in this case. Thanks!
Re: Dialog -
Lajko1 - 19.11.2013
pawn Код:
format(string, sizeof(string), "%s%s(%d)\n", string, GetName,playerid);
this is to get playerid..
To get dialog id try to use switch(dialogid) somehow
Re: Dialog -
iGetty - 19.11.2013
Edit: Wrong.
Re: Dialog -
RedCounty - 19.11.2013
Quote:
Originally Posted by Lajko1
pawn Код:
format(string, sizeof(string), "%s%s(%d)\n", string, GetName,playerid);
this is to get playerid..
To get dialog id try to use switch(dialogid) somehow
|
You're not reading it right.
I know how to get the dialog ID, I don't need to display the playerid.
For instance, I press "player10", but there's only 4 people online, id 0, id 1, id 2, id, 10 - It will display all the players on the dialog, but it will think that it's playerid 4, due to it being listitem 4, is there a way to not do that?
Quote:
Originally Posted by iGetty
Edit: Wrong.
|
Hmm?
Re: Dialog -
-Prodigy- - 19.11.2013
The easiest way is to store the ID in a global bar for each listitem slot. Something like below should do the work:
pawn Код:
// at the top
new gPlayerList[MAX_PLAYERS];
// when you use this:
new slot;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "%s%s\n", string, GetName);
gPlayerList[slot] = i;
slot ++;
}
}
ShowPlayerDialog(playerid, DIALOG_TRANSFER, DIALOG_STYLE_LIST, "Transfer", string, "Transfer", "");
// on dialog resp
case DIALOG_TRANSFER:
{
new pid = gPlayerList[listitem];
SendClientMessage(pid, -1, "Transfer success!");
}
Re: Dialog -
RedCounty - 23.11.2013
I'll try that, thanks for the reply!