fCommand:
pawn Код:
#include <a_samp>
#define COR_MSG 0xFFAF00FF
#define fcmd(%1,%2) \
forward fcmd_%1(%2); \
public fcmd_%1(%2)
#define MaxFrequence (025)
#define MaxParameter (064)
#define MaxFunctions (032)
#define MaxLenString (128)
new
sIndex = 0,
iLenPart = 0,
iPosPart = 0,
iStrMid = 0,
iLenght = 0,
iParams[ MaxFrequence ][ MaxParameter ],
cmds[ MaxFunctions ]
;
public OnPlayerCommandText(playerid,cmdtext[])
return DelimiterCommand(playerid,cmdtext,iParams);
stock
DelimiterCommand(playerid,sStringSource[], sStringDetination[][])
{
iLenght = strlen(sStringSource);
sIndex = 0;
iLenPart = 0;
iPosPart = 0;
iStrMid = 0;
format(cmds,MaxLenString,sStringSource[1]);
while(sIndex <= iLenght)
{
if(sStringSource[sIndex] == ' ' || sIndex == iLenght)
{
iStrMid = strmid(sStringDetination[iPosPart], sStringSource, iLenPart, sIndex, 128);
sStringDetination[iPosPart][iStrMid] = 0,iLenPart = (sIndex + 1), ++iPosPart;
}
++sIndex;
}
if(iPosPart != 0)
format(cmds,MaxFunctions,"fcmd_%s",iParams[0][1]);
return CallLocalFunction(cmds,"i",playerid);
}
///// COMANDO DE CRIAR LABEL /////////////
fcmd(label,playerid)
{
if(!iParams[1] || iParams[2])
SendClientMessage(playerid,COR_MSG,"/label [name]");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z );
Create3DTextLabel(iParams[1],COR_MSG, X,Y,Z, 40,0);
SendClientMessage(playerid,COR_MSG,iParams[1]);
SendClientMessage(playerid,COR_MSG,"Criado!");
return true;
}
/label [name]