17.02.2011, 14:36
Just for the fun of it i made it a lil bit faster and named it scmd for "Super Command"!!!!!!!!
Enjoy,
KEEP ME IN CREDITS!!!!! xDDDDDD
((ZCMD FTW!))
Enjoy,
KEEP ME IN CREDITS!!!!! xDDDDDD
pawn Код:
#include <a_samp>//Credits to SA-MP Developers!
#include <sscanf2>//Credits to whoever made this!
#define scmd(%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 call_scmd(%1) format(params,sizeof(params),""%1" %s",params),CallLocalFunction("OnPlayerCommandText","ds",playerid,params)
public OnPlayerCommandText(playerid, cmdtext[])
{
new params[128];
scmd("/say")//A simple /say command :D
{
new getplayerid, msg, pName[24], string[128];
if(sscanf(params, "d", msg)) return SendClientMessage(playerid,0x0,"USAGE: /say [msg]");
GetPlayerName(getplayerid, pName, sizeof(pName));
format(string,sizeof(string),"* %s [%d] Says: %s",pName,getplayerid,msg);
SendClientMessageToAll(0x0,string);
return true;
}
else scmd("/msg") return call_scmd("/say");//Also /msg will show /say :O!
scmd("/help")//A simple /help command :D
{
SendClientMessageToAll(0x0,"Help Messages..");
return true;
}
else scmd("/info") return call_scmd("/help");//Also /info will show /help :O!
scmd("/ban")//A simple /ban command :D
{
new getplayerid, bName[24], str[128], Reason[64];
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0x0,"Your Not An Admin!");
if(sscanf(params, "Ud",getplayerid, Reason)) return SendClientMessage(playerid,0x0,"USAGE: /ban [id] [reason]");
GetPlayerName(getplayerid, bName, sizeof(bName));
format(str,sizeof(str),"%s [%d] Has Been Banned! [Reason: %s]",bName, getplayerid, Reason);
SendClientMessageToAll(0x0,str);
BanEx(getplayerid,str);
return true;
}
return false;
}
//No more str-crap :D