SampSharp
SampSharp copied to clipboard
Dialog Show Async - SampSharp.Entities.SAMP
Hi, i need to show a dialog asynchronously using SampSharp.Entities framework. How can i do that?
Thanks.
Hi!
Here's a simple example:
public class Issue400AsyncDialogs : ISystem
{
[PlayerCommand("asyncdialog")]
public async void ShowAsyncDialog(Player player, IDialogService dialogService)
{
var response = await dialogService.Show(player,
new InputDialog { Caption = "Question", Content = "What's your favorite food?", Button1 = "OK" });
if (response.Response == DialogResponse.LeftButton)
{
player.SendClientMessage($"You like {response.InputText}!");
}
}
}
It worked for me, thank you very much.
May I suggest changing the method name to ShowAsync?
done.