22.01.2011, 19:15
Hello all,
I had started programming my own gamemode when I realized that the way OnDialogResponse is handled is messy and confusing. Henceforth, I made my own include for it. I decided to share this with you all in hopes that it helps make scripting easier.
The function is called based on the dialog ID and which button was clicked.
Please note that this works perfectly, but I have future plans for it also.
Syntax:
Usage Example:
Note that if you leave one of the button functions undefined, it will still work, and it will work with your current script.
Credits: ****** to his library hooks.
Download: Comments are appreciated.
I had started programming my own gamemode when I realized that the way OnDialogResponse is handled is messy and confusing. Henceforth, I made my own include for it. I decided to share this with you all in hopes that it helps make scripting easier.
The function is called based on the dialog ID and which button was clicked.
Please note that this works perfectly, but I have future plans for it also.
Syntax:
Код:
Dialog:[dialogID]_[Btn1 or Btn2](listitem, playerid, inputtext[]){ return 1; }
PHP код:
#include <dialog>
public OnPlayerConnect( playerid )
{
ShowPlayerDialog( playerid, 0, DIALOG_STYLE_INPUT, " ", "Welcome to Project Fresh. Please login with your username below or register.", "Next >>", "<Register>" );
return(1);
}
Dialog:0_Btn1(listitem, playerid, inputtext[]){
SetPlayerName(playerid, inputtext);
return(1);
}
Dialog:0_Btn2(listitem, playerid, inputtext[]){
SendClientMessage( playerid, X11_ANTIQUEWHITE1, "This account is not registered, and registrations are closed, sorry!" );
return(1);
}
Credits: ****** to his library hooks.
Download: Comments are appreciated.