New type of dialogs, some guidelines
#1

Alright so Im trying to pull something off in Pawn but I've stumbled upon a problem that can be resolved with like async and such but as I know thats not possible in Pawn.

Alright so here it is how it should work:

1. ShowPlayerDialog will return the list item they clicked on (works)
2. Command code will continue and give the certain reward depending on clicked listitem

Now the problem is (as its obvious) the code inside the command will continue no matter if it received a response from the Dialog or not.


Code:
pawn Код:
CMD:test(playerid,params[]) {
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Test","Weapon 1\nWeapon 2\nWeapon 3","Okay","Bye");
   
    new response = getLastResponse(playerid);
   
    switch(response) {
        case 0: GivePlayerWeapon(playerid,24,100);
        case 1: GivePlayerWeapon(playerid,31,100);
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response) return true;
    setLastResponse(playerid, listitem);
    return 1;
}


stock setLastResponse(playerid, listitem) last_Response[playerid] = listitem;
stock getLastResponse(playerid) return last_Response[playerid];
The only way I find it being useable is by simple have a goto for this but goto is simply horrible use but at the same time its possible with it (altho Im not really satisfied how I could do it with it)...

3rd solution would be a timer thats like 3 seconds that will repeat until it finds a valid response
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)