SA-MP Forums Archive
Is it possible to make command without forward slash? - 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: Is it possible to make command without forward slash? (/showthread.php?tid=577370)



Is it possible to make command without forward slash? - RaeF - 11.06.2015

Is it possible?

eg: !help !stats !admin


Re: Is it possible to make command without forward slash? - SickAttack - 11.06.2015

Yes, it is.


Re: Is it possible to make command without forward slash? - Banana_Ghost - 11.06.2015

Use OnPlayerText and compare their input to your defined text. If it matches, execute the command's code and return 0 under OnPlayerText to prevent the text they typed from entering the chat.


Re: Is it possible to make command without forward slash? - JaydenJason - 11.06.2015

Код:
if(!strcmp(cmdtext, "!help", true))
Wouldn't this work?


AW: Re: Is it possible to make command without forward slash? - Kaliber - 11.06.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Wouldn't this work?
No.

Because OnPlayerCommandText get Only called when you write a /

You have to call the function again under OnPlayerText when it starts with !

PHP код:
if(text[0] == '!'OnPlayerCommandText(playerid,text); //For example