SA-MP Forums Archive
[Include] [MACROS] ycmd, easy & usefull cmd system - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [MACROS] ycmd, easy & usefull cmd system (/showthread.php?tid=157228)

Pages: 1 2


[MACROS] ycmd, easy & usefull cmd system - YmOn - 06.07.2010

What It?
It Easy cmd system, Vety usefull for filterscrits where you cant use strtok function
How To Use It?
Very Easy!
Examples:
Command /me [text]
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new params[128];
	ycmd("/me")
	{
	    if(!strlen(params))return SendClientMessage(playerid,COLOR_MAIN,"USAGE: /me [text]");
	    new string[256];
	    format(string,sizeof(string),"** %s [ID: %d] %s",PlayerName(playerid),playerid,params);
	    SendClientMessageToAll(COLOR_MAIN,string);
	    return true;
	}
	return false;
}
Command /ban [playerid] [reason]
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new params[128];
    ycmd("/ban")
    {
        if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,COLOR_MAIN,"You Not Admin");
        if(!strlen(params))return SendClientMessage(playerid,COLOR_MAIN,"USAGE: /ban [playerid] [reason]");
        new idx, BannedID = strval(strtok(params,idx)),MessString[256],ReasonString[64];
        if(!strlen(params[idx]))ReasonString = "N/A";else format(ReasonString,sizeof(ReasonString),"%s",params[idx]);
        format(MessString,sizeof(MessString),"Admin %s [ID:%d] Ban %s [ID:%d] [Reason: %s]",PlayerName(playerid),playerid,PlayerName(BannedID),BannedID,ReasonString);
        SendClientMessageToAll(COLOR_MAIN,MessString);
        BanEx(BannedID,MessString);
	return true;
   }
   return false;
}
Command /pm | msg [playerid] [text]
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        new params[128];
	ycmd("/pm")
	{
            new idx, tmp[256], id, string[256];
            tmp = strtok(params,idx);
	    if(!strlen(tmp))return SendClientMessage(playerid,COLOR_MAIN,"USAGE: /pm | msg [playerid] [text]");
	    id = strval(tmp);
	    tmp = strtok(params,idx);
	    if(!strlen(tmp))return SendClientMessage(playerid,COLOR_MAIN,"USAGE: /pm | msg [playerid] [text]");
	    format(string,sizeof(string),"* PM From %s [ID: %d] To %s [ID: %d]",PlayerName(playerid),playerid,PlayerName(id),id,tmp);
	    SendClientMessage(playerid,COLOR_MAIN,string);
	    SendClientMessage(id,COLOR_MAIN,string);
	    return true;
	}
	ycmd("/msg")return ycmd_red("/pm");
	
	return false;
}
cmd Speed
Sory But Speed is not Fantastic...

Where Get This Macroses?
Here!
Код:
#define ycmd(%1) if(!strcmp(cmdtext,%1,true,strlen(%1))&&((!strlen(cmdtext[strlen(%1)])&&format(params,sizeof(params),""))||(cmdtext[strlen(%1)]==' '&&format(params,sizeof(params),"%s",cmdtext[strlen(%1)+1]))))
#define ycmd_red(%1) format(params,sizeof(params),""%1" %s",params),CallLocalFunction("OnPlayerCommandText","ds",playerid,params)
You Have Any Examle Script?
Yeh!
There Pastebin Click

Comment Please!!!
Sory For bad english


Re: [MACROS] ycmd, easy & usefull cmd system - iZN - 06.07.2010

Ahh, 3rd cmd system. Good Work Ymon.


Re: [MACROS] ycmd, easy & usefull cmd system - nuriel8833 - 06.07.2010

Great work =)


Re: [MACROS] ycmd, easy & usefull cmd system - Masj - 06.07.2010

So... why do we need new command processor, if it isn't faster?


Re: [MACROS] ycmd, easy & usefull cmd system - YmOn - 06.07.2010

Its the easyst!


Re: [MACROS] ycmd, easy & usefull cmd system - CaHbKo - 06.07.2010

'cmdtext' shouldn't ever exceed 128 cells... so make the 'params' 128.


Re: [MACROS] ycmd, easy & usefull cmd system - YmOn - 06.07.2010

Oh, thanks, i fixed it


Re: [MACROS] ycmd, easy & usefull cmd system - SlashPT - 06.07.2010

not bad keep it up


Re: [MACROS] ycmd, easy & usefull cmd system - Calgon - 06.07.2010

Looks terribly scripted. ZCMD prevails.


Re: [MACROS] ycmd, easy & usefull cmd system - Jantjuh - 06.07.2010

Quote:
Originally Posted by Masj
Посмотреть сообщение
So... why do we need new command processor, if it isn't faster?
cuz this one is more simple for newbies noob ><


Re: [MACROS] ycmd, easy & usefull cmd system - YmOn - 06.07.2010

******, You have y_cmd system =)


Re: [MACROS] ycmd, easy & usefull cmd system - Sergei - 07.07.2010

Why would be need another command processor when we have zcmd?


Re: [MACROS] ycmd, easy & usefull cmd system - Toni - 07.07.2010

Quote:
Originally Posted by Sergei
Посмотреть сообщение
Why would be need another command processor when we have zcmd?
or dcmd? o_O


Re: [MACROS] ycmd, easy & usefull cmd system - Calgon - 07.07.2010

Quote:
Originally Posted by The Toni
Посмотреть сообщение
or dcmd? o_O
zcmd > dcmd.

I can create useless posts too.


Re: [MACROS] ycmd, easy & usefull cmd system - YmOn - 07.07.2010

in dcmd you may type /me*use dcmd
in may command engine you may use only /me love ycmd


Re: [MACROS] ycmd, easy & usefull cmd system - Toni - 07.07.2010

Quote:
Originally Posted by Calgon
Посмотреть сообщение
zcmd > dcmd.

I can create useless posts too.
Yesssss I can and you can...:P


Re: [MACROS] ycmd, easy & usefull cmd system - Lorenc_ - 07.07.2010

Thats nice


Re: [MACROS] ycmd, easy & usefull cmd system - Romanius - 07.07.2010

Quote:

It Easy cmd system, Vety usefull for filterscrits where you cant use strtok function

But in "Command /ban [playerid] [reason]" simple you use strtok


Re: [MACROS] ycmd, easy & usefull cmd system - MaTrIx4057 - 07.07.2010

I'm loling at people who are yelling "why we need this if we got zcmd already", well then why we need other RP/DM/Race/TDM scripts if we have already some released. People release what they want, no matter what you say. Really if you don't like what he has made then you can just gtfo.


Re: [MACROS] ycmd, easy & usefull cmd system - Orhun_Dakilir - 07.07.2010

Good Work...