new str[256],id = 1;
foreach(new i: HouseKey[playerid])
{
format(str,sizeof(str),"%s[%d]\n",str,id);
id++;
}
ShowPlayerDialog(playerid,DIALOG_HOUSE_LIST,DIALOG_STYLE_LIST,"Select House",str,"OK","");
case DIALOG_HOUSE_LIST:
{
if(response == 1)
{
new skip=0;
foreach(new i: HouseKey[playerid])
{
if(skip == listitem)
{
printf("Player is click on ID : %i",i);
break;
}
else
{
skip++;
}
}
}
}
case DIALOG_HOUSE_LIST:
{
if(response == 1 && inputtext[0])
{
printf("Player is click on ID : %i",strval(inputtext[1]));
}
}
|
Hi guys
I add house keys for player on an iterator. new Iterator: HouseKey[MAX_PLAYERRS]<MAX_HOUSES>; When player type /house he can see list of his house and manage them. Код:
new str[256],id = 1;
foreach(new i: HouseKey[playerid])
{
format(str,sizeof(str),"%s[%d]\n",str,id);
id++;
}
ShowPlayerDialog(playerid,DIALOG_HOUSE_LIST,DIALOG_STYLE_LIST,"Select House",str,"OK","");
Код:
case DIALOG_HOUSE_LIST:
{
if(response == 1)
{
new skip=0;
foreach(new i: HouseKey[playerid])
{
if(skip == listitem)
{
printf("Player is click on ID : %i",i);
break;
}
else
{
skip++;
}
}
}
}
|
new str[256], buff[10], id = 1, c = 0;
foreach(new i: HouseKey[playerid])
{
format(buff, sizeof(buff), "Key_%d", c);
SetPVarInt(playerid, buff, id);
format(str,sizeof(str),"%s[%d]\n",str,id);
id++;
c++;
}
ShowPlayerDialog(playerid,DIALOG_HOUSE_LIST,DIALOG_STYLE_LIST,"Select House",str,"OK","");
case DIALOG_HOUSE_LIST:
{
if(response == 1)
{
new buff[10], id;
format(buff, sizeof(buff), "Key_%d", listitem);
id = GetPVarInt(playerid, buff);
printf("Player is click on ID : %i", id);
}
}
new Iterator: HouseKey<MAX_PLAYERS, MAX_HOUSES>;
|
Do you want to detect which menu option selects the player or which house (houseid) is it in? |