30.08.2018, 21:17
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.
Now I need to detect which house id is he click.But I don't know how to do it.I'm do it on this way but i'm sure that it's wrong.(Yes it work,but it's bad code,i guess)
So I need advice how to improve my code optimization.
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++; } } } }