Making a cmd
#1

Hello, I was wondering if I could make a command like /rules and then will pop up a little windows with the rules. Nothing fancy, just plain.

How is that made?
Reply
#2

Код:
if(strcmp(cmd, "/command", true) == 0)
{
    ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE,"Rules","1. You must respect the rules\n2.You can't do anything without read the rules...","button1","button2");
    return 1;
}

- Things that may be helpful.
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/Dialog_Styles
Reply
#3

Quote:
Originally Posted by Larceny
Посмотреть сообщение
Код:
if(strcmp(cmd, "/command", true) == 0)
{
    ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE,"Rules","1. You must respect the rules\n2.You can't do anything without read the rules...","button1","button2");
    return 1;
}

- Things that may be helpful.
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/Dialog_Styles
Ok thanks! But how to make it into a FS? Do I start pawno and make a new file and then just c/p? Or am I supposed to add it to any line?
Reply
#4

Add it under OnPlayerCommandText(playerid,cmdtext[]).

Like this:
Код:
public OnPlayerCommandText(playerid,cmdtext[])
{	
    new cmd[256];
    if(strcmp(cmd, "/rules", true) == 0)
    {
	ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE,"Rules","1. You must respect the rules\n2.You can't do anything without read the rules...","button1","button2");
	return 1;
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Larceny
Посмотреть сообщение
Add it under OnPlayerCommandText(playerid,cmdtext[]).

Like this:
Код:
public OnPlayerCommandText(playerid,cmdtext[])
{	
    new cmd[256];
    if(strcmp(cmd, "/rules", true) == 0)
    {
	ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE,"Rules","1. You must respect the rules\n2.You can't do anything without read the rules...","button1","button2");
	return 1;
    }
    return 1;
}
OnPlayerCommandText doesn't return 1 twice.

Код:
public OnPlayerCommandText(playerid,cmdtext[])
{	
    new cmd[256];
    if(strcmp(cmd, "/rules", true) == 0)
    {
	ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE,"Rules","1. You must respect the rules\n2.You can't do anything without read the rules...","button1","button2");
	return 1;
    }
    return 0;
}
And you don't need to color your text like that, as its a pain in the ass. Use [ pawn] [/ pawn] tags.
Reply
#6

C:\Users\Aрalsteinn\Desktop\Mine\filterscripts\rul ez.pwn(94) : error 017: undefined symbol "DIALOG_ID"

?
Reply
#7

Quote:
Originally Posted by Schurman
Посмотреть сообщение
OnPlayerCommandText doesn't return 1 twice.
My Mistake, thank you.

Quote:
Originally Posted by Schurman
Посмотреть сообщение
And you don't need to color your text like that, as its a pain in the ass. Use [ pawn] [/ pawn] tags.
My code won't confuse no one, and in some cases it help the understanding.

Quote:
Originally Posted by ColdIce
Посмотреть сообщение
C:\Users\Aрalsteinn\Desktop\Mine\filterscripts\rul ez.pwn(94) : error 017: undefined symbol "DIALOG_ID"

?
You need to change it to dialog id you want(numbers), to be called in:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Reply
#8

So instead of dialogid I put "666" for example?
Reply
#9

Yes, you can put the number you want.
but be careful not to repeat in two different dialogs.
Reply
#10

fucking shit stop telling newbies about old and slow methods!
pawn Код:
CMD:rules(playerid, params[]) // zcmd by Zeex
{
     return something;
}
use it before you regret halfway!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)