SA-MP Forums Archive
Making a cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Making a cmd (/showthread.php?tid=247802)



Making a cmd - ColdIce - 10.04.2011

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?


Re: Making a cmd - Shelby - 10.04.2011

Код:
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



Re: Making a cmd - ColdIce - 10.04.2011

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?


Re: Making a cmd - Shelby - 10.04.2011

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;
}



Re: Making a cmd - SchurmanCQC - 10.04.2011

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.


Re: Making a cmd - ColdIce - 10.04.2011

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

?


Re: Making a cmd - Shelby - 10.04.2011

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[])



Re: Making a cmd - ColdIce - 10.04.2011

So instead of dialogid I put "666" for example?


Re: Making a cmd - Shelby - 10.04.2011

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


Re: Making a cmd - admantis - 10.04.2011

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!