项目作者: NexiusTailer

项目描述 :
Dialogs with a new design
高级语言: Pawn
项目地址: git://github.com/NexiusTailer/Alternative-Dialogs.git
创建时间: 2021-07-10T11:41:51Z
项目社区:https://github.com/NexiusTailer/Alternative-Dialogs

开源协议:

下载


Alternative Dialogs

These dialogs have nearly all of the functions that the default dialogs have, but they can be used together.
The new design drawn via textdraws, it will radically change the interface of your server.

How do they look

AD_STYLE_LIST / SKINS

To choose any of the available skins, just write the following before connecting the include:

  1. #define AD_SKIN_1 //1 - ID of the skin

How to install

Simply install to your project:

  1. sampctl package install NexiusTailer/Alternative-Dialogs

Include in your code and begin using the library:

  1. #include <alt_dialogs>

Functions

  • ShowPlayerAltDialog(playerid, dialogid, style, caption[], info[], button1[], button2[] = "")
    Use to show the dialog for a player
  • OnAltDialogResponse(playerid, dialogid, response, listitem)
    Called when a player “response” on the dialog
  • GetPlayerAltDialog(playerid)
    Use to get a player’s current dialog ID

Usage example

  1. public OnPlayerCommandText(playerid, cmdtext[])
  2. {
  3. if(!strcmp("/wdialog", cmdtext, true)) return cmd_wdialog(playerid);
  4. return 0;
  5. }
  6. forward cmd_wdialog(playerid);
  7. public cmd_wdialog(playerid)
  8. {
  9. ShowPlayerAltDialog(playerid, 0, AD_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Ok", "Cancel");
  10. return 1;
  11. }
  12. public OnAltDialogResponse(playerid, dialogid, response, listitem)
  13. {
  14. if(dialogid == 0)
  15. {
  16. if(response == 1)
  17. {
  18. switch(listitem)
  19. {
  20. case 0: GivePlayerWeapon(playerid, 30, 100);
  21. case 1: GivePlayerWeapon(playerid, 31, 100);
  22. case 2: GivePlayerWeapon(playerid, 34, 50);
  23. }
  24. return 1;
  25. }
  26. }
  27. return 0;
  28. }

Thanks

Zamaroht and adri1 for Zamaroht’s Textdraw Editor

Frequently asked Questions

Q: How to hide the shown dialog?
A: This can be done like in default dialogs.
Use ShowPlayerAltDialog function, specifying dialogid parameter with the value of -1.

Q: What does the response parameter mean with the value of 2 in OnAltDialogResponse?
A: This means that the dialog was closed by pressing the "cross" button or by ESC.

Q: How to make the separate words in the dialog colored?
A: In this case you can use that.

This section will be updated as questions are received.