[Include] [MACROS] ycmd, easy & usefull cmd system
#1

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

Ahh, 3rd cmd system. Good Work Ymon.
Reply
#3

Great work =)
Reply
#4

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

Its the easyst!
Reply
#6

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

Oh, thanks, i fixed it
Reply
#8

not bad keep it up
Reply
#9

Looks terribly scripted. ZCMD prevails.
Reply
#10

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 ><
Reply
#11

******, You have y_cmd system =)
Reply
#12

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

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

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

I can create useless posts too.
Reply
#15

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

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

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

Thats nice
Reply
#18

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
Reply
#19

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

Good Work...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)