SA-MP Forums Archive
"USAGE:" For commands - 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: "USAGE:" For commands (/showthread.php?tid=410632)



"USAGE:" For commands - Goldino - 26.01.2013

Hey guys, I'm making some commands for my server. I was wondering how you can add a "USAGE:" When someone does the command in the wrong way! For example. If someone just does /me, it should say "USAGE: /me <text>. I hope you can help me!


Re: "USAGE:" For commands - IgrexolonO - 26.01.2013

https://sampwiki.blast.hk/wiki/Fast_Commands No problem.


Re: "USAGE:" For commands - CoDeZ - 26.01.2013

You need sscanf to do this or isnull() from ZCMD
anyways i made a quick one for ya
pawn Код:
CMD:me(playerid,params[])
{
    new Message[128];
    if(isnull(params)) return SendClientMessage(playerid,white,"USAGE:/me <text>");
    if(sscanf(params,"s[128",Message)) return SendClientMessage(playerid,white,"USAGE:/me <text>");
    return 1;
}



Re: "USAGE:" For commands - Jewell - 26.01.2013

Quote:
Originally Posted by Goldino
Посмотреть сообщение
Hey guys, I'm making some commands for my server. I was wondering how you can add a "USAGE:" When someone does the command in the wrong way! For example. If someone just does /me, it should say "USAGE: /me <text>. I hope you can help me!
easy, if you are using ****** sscanf plugin then you can simply put a line like this
pawn Код:
new text[128]
if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,0xE6E61AC8,"Usage /me <atext>");
you can read here for more info https://sampforum.blast.hk/showthread.php?tid=120356

or you can do
pawn Код:
if(isnull(params)) return SendClientMessage(playerid,0xE6E61AC8,"Usage /me <atext>");



Re: "USAGE:" For commands - Mean - 26.01.2013

with strcmp:
pawn Код:
if(!strcmp(cmdtext, "/hi", true)) {
    if(!strlen(cmdtext[4])) return SendClientMessage(playerid, -1, #USAGE: ...);
    return 1;
}