Need Help About "dcmd"
#1

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 ^_^
Reply
#2

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.
Reply
#3

Thanks ^_^
i understand now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)