16.08.2013, 17:45
use dcmd
pawn Код:
//add this line on top of your script
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//Publics:
forward SendAdminMessage(color, string[]);
public SendAdminMessage(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
//if(PlayerInfo[i][pAdmin] >= 7)//Admin level defining by Y_INI
if(IsPlayerAdmin[i]) //defined for RCON admins
{
SendClientMessage(i, COLOR_YELLOW, string);
}
}
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(r,1,cmdtext);
return 1;
}
//command:
dcmd_r(playerid,params[])
{
new string[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
if(!strlen(params))
{
SendClientMessage(playerid,COLOR_ERROR,"[USAGE] /ac (Message)");
return 1;
}
format(string,sizeof(string),"Admin %s(%d): %s",pname,playerid,params);
SendAdminMessage(COLOR_YELLOW,string);
return 1;
}
SEARCH BEFORE POSTING