[Tutorial] Creating a Mesage Dialog for your script
#1

NOTE: We will use a vip commands menu for this.

The First Start
Open Pawno.
Click "New" at the top.
Then do these steps:

At the top, after
pawn Код:
#include <a_samp>
,
Put this:
pawn Код:
#define DIALOG_VIPHELP 1
.
The Middle Front
Then go to:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
.

It should look like this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
Change "/mycommand" to your liking. I will be using /vcmds for this tutorial since i am creating a vip menu.
The Final Push
Change:
pawn Код:
//Do something here
to:
pawn Код:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Vip Commands", "VIP COMMANDS\n/healme\n/vcmds\n/armourme\n/vipkill\nMORE COMMANDS TO COME", "OK", "Cancel");
NOTE: Make sure that is all on one line, not two.

Then, Press The compile button at the top (or F5), and you should get:
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Congratulations. You just created your message dialog!
Reply
#2

What should this be? This is showing a simple dialog, yes, but what if a player is clicking on the button of the dialog? NOTHING will continue, you didn't even try to continue scripting! You would have had to continue under "OnDialogResponse" and set some functions there! This is really one of the most useless tutorials I've ever seen, sorry! I mean, for this little piece, you could simply do the following:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {        
       SendClientMessage(playerid, COLOR_YELLOW, "/healme, /makebettertutorial, etc...");
   
    return 1;
    }    
return 0;
}
Reply
#3

If nothing happened when you click OK, the compiler wouldn't compile
Reply
#4

You didn't even explain THAT SMALL PIECE OF CODE.
This is just a bad tutorial.
Reply
#5

fine people... I am hating the pawno compiler right now... Its betraying me...

ADMIN REMOVE IT
Reply
#6

Congratulations!
Quote:
Originally Posted by stormchaser206
Посмотреть сообщение
If nothing happened when you click OK, the compiler wouldn't compile
You are wrong. The compiler has nothing to do with this. I can have code at OnDialogResponse Callback that does something on Button1 or Button2, but I may not have at all. It will compiles fine. You didn't explain anything and you suggest them how to make a command with strcmp( not even command processor, but a string comparison ) using wrong length and get the message "SERVER: Unknown command."

pawn Код:
// Change "/mycommand" to your liking. I will be using /vcmds for this tutorial since i am creating a vip menu.
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
Reply
#7

i have tried to explain the msg dialog in my tut see and tell hows it? i wrote it in 2 min lol
Reply
#8

Quote:
Originally Posted by TRIPLE-xXx-GAMEING
Посмотреть сообщение
i have tried to explain the msg dialog in my tut see and tell hows it? i wrote it in 2 min lol
No, you didn't explain it.
Also, tutorial could take even 2 hours to make, not 2 mins.
Reply
#9

Guy search showplayerdialog on ****** and goto wikI

That is much better than this tutoriAl !
Reply
#10

This is not a tutorial, you're just showing people code which they will copy and paste and change the text. You need to properly and clearly explain all the functions, parameters and outcomes. You don't talk about dialog types, dialog IDs, responses, hell, you don't even show a picture of a dialog!

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)