Quick STRCMP to DCMD Tutorial please -
<Weponz> - 30.10.2010
Can someone please give me some Turorials on DCMD or show me what is changed from the STRCMP code to the DCMD code,Ill a example with STRCMP if someone could kindly convert and deaply explain how its diffrent to me plz
And are the fuctions the same just the codeing?
eg. My command codes start from this base..
Код:
if (strcmp("/command", cmdtext, true) == 0)
{
//functions
return 1;
}
Thanks in advanced
Re: Quick STRCMP to DCMD Tutorial please -
WillyP - 30.10.2010
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(examplecmd,11,cmdtext); //command, length of command, then the command text itself..
return 0;
}
dcmd_examplecmd(playerid,params[])
#pragma unused params
{
SendClientMessage(playerid,BLUE,"IT WORKS!");
return 1;
}
you use
if you dont have any params
Re: Quick STRCMP to DCMD Tutorial please -
Seven. - 30.10.2010
#pragma unused params needs to be inside the brackets.
Re: Quick STRCMP to DCMD Tutorial please -
<Weponz> - 30.10.2010
Quote:
Originally Posted by Seven.
#pragma unused params needs to be inside the brackets.
|
#pragma/param




?
Please give me examples...Make a /heal and a /help plz
Re: Quick STRCMP to DCMD Tutorial please -
Seven. - 30.10.2010
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(heal,4,cmdtext); // heal has 4 letters so you enter a 4
dcmd(help,4,cmdtext); // same here..
return 0;
}
pawn Код:
dcmd_heal(playerid,params[])
{
#pragma unused params
SetPlayerHealth(playerid,100);
return true;
}
pawn Код:
dcmd_help(playerid,params[])
{
#pragma unused params
SendClientMessage(playerid,color,"Help message?");
return true;
}
Re: Quick STRCMP to DCMD Tutorial please -
<Weponz> - 30.10.2010
Quote:
Originally Posted by Seven.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(heal,4,cmdtext); // heal has 4 letters so you enter a 4 dcmd(help,4,cmdtext); // same here.. return 0; }
pawn Код:
dcmd_heal(playerid,params[]) { #pragma unused params SetPlayerHealth(playerid,100); return true; }
pawn Код:
dcmd_help(playerid,params[]) { #pragma unused params SendClientMessage(playerid,color,"Help message?"); return true; }
|
So this dcmd(heal,4,cmdtext);
is like this new cmd[256]; ?
And wow how easy is DCMD :O i now see how its processed faster and it acually looks easier to type xD
BTW no includes or special functions?? And callbacks stay the same?
Kool thanks dude ima start scripting in DCMD now
EDIT: this #pragma unused params is needed for every single command?
Re: Quick STRCMP to DCMD Tutorial please -
WillyP - 30.10.2010
Quote:
Originally Posted by Seven.
#pragma unused params needs to be inside the brackets.
|
no it doesnt....
Re: Quick STRCMP to DCMD Tutorial please -
karakana7 - 30.10.2010
Can someone teach me?

So what exactly this #pragma unused params do?And also explain me about return true; for what is it used?
Re: Quick STRCMP to DCMD Tutorial please -
Cameltoe - 30.10.2010
Quote:
Originally Posted by karakana7
Can someone teach me?  So what exactly this #pragma unused params do?And also explain me about return true; for what is it used?
|
If you don't use the parameters, DCMD will complain about that params is unused. #pragma unused params will fix this.
Re: Quick STRCMP to DCMD Tutorial please -
karakana7 - 30.10.2010
Quote:
Originally Posted by Cameltoe
If you don't use the parameters, DCMD will complain about that params is unused. #pragma unused params will fix this.
|
Thank you for the helping.What parameters you can use for dcmd,zcmd?And also one last thing about that is what doing the return true; code?