SA-MP Forums Archive
Need Help About "dcmd" - 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)
+--- Thread: Need Help About "dcmd" (/showthread.php?tid=336734)



Need Help About "dcmd" - Tama - 23.04.2012

Hello ,
i have a game modes it's use a strcmp commands processor and i want add a dcmd commands , but there is not work.
i dont understand this code below :
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(xgoto, 5, cmdtext);
maybe someone can help me to explain this script? i know that was for commands what the scripters want to do..
but i dont understand what the meaning of dcmd(xgoto, 5, cmdtext);

Thank you ^_^


Re: Need Help About "dcmd" - Mark™ - 23.04.2012

Example, taken from wiki :

pawn Код:
dcmd(heal, 4, cmdtext);
That line basically declares the command, it checks the variable cmdtext to see if you typed /heal, the number 4 is the length of the word "heal", the word "heal" (without double quotes) is both the command to type and part of the function to call.

The function dcmd_heal is the command name you entered in the dcmd line with dcmd_ put in front. It has two parameters, the first, playerid, is the player who typed the command, just like OnPlayerCommandText. The second, params[], is the string entered after the command, this is very similar to cmdtext[] but ONLY contains command parameters (or nothing if no parameters were entered, as shown in the example above).

This is all you need to know to use dcmd, most people are put off by the last remaining part, however this was purposefully left to last as you do not need to understand it at all to use it.


Re: Need Help About "dcmd" - Tama - 23.04.2012

Thanks ^_^
i understand now.