#include <zcmd>
#include <sscanf2>
#define SCM SendClientMessage
#define ACTIONRANGE 10 //metres
//COMMAND ME ACTION
CMD:me(playerid, params[])
{
new string[350], action[350];
if(sscanf(params, "s[350]", action))
{
SCM(playerid, COLOR_ERROR, "Usage: /me [action]");
return 1;
}
else
{
new pName[32];
GetPlayerName(playerid,pName,32);
format(string, sizeof(string), "%s %s", pName, action);
ProxDetector(ACTIONRANGE, playerid, string, COLOR_ACTION);
}
return 1;
}
//COMMAND DO ACTION
CMD:do(playerid, params[])
{
new
string[128],
action[100];
if(sscanf(params, "s[100]", action))
{
SCM(playerid, COLOR_ERROR, "Usage: /do [action]");
return 1;
}
else
{
new pName[32];
GetPlayerName(playerid,pName,32);
format(string, sizeof(string), "* %s * (( %s ))", params, pName);
ProxDetector(ACTIONRANGE, playerid, string, COLOR_ACTION);
}
return 1;
}
stock ProxDetector(Float:radi, playerid, string[],color)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
{
SCM(i,color,string);
}
}
}
pawn Код:
|