pawn Код:
CMD:me(playerid, params[])
{
new string[128], pname[24], action[128];
pname = GetName(playerid);
if (sscanf(params, "s", action)) return SendClientMessage(playerid, 0x787878AA, "Usage: /me <action>");
else for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerToPlayer(playerid,i,7))
{
strreplace(pname, '_', ' ');
format(string, sizeof(string), "* %s %s *", pname, action);
SendClientMessage(i, COLOR_PURPLE, string);
return 1;
}
}
return 1;
}
CMD:do(playerid, params[])
{
new string[128], pname[24], action[128];
pname = GetName(playerid);
if (sscanf(params, "s", action)) return SendClientMessage(playerid, 0x787878AA, "Usage: do <action>");
else for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerToPlayer(playerid,i,7))
{
strreplace(pname, '_', ' ');
format(string, sizeof(string), "* %s ((%s)) *", action, pname);
SendClientMessage(i, COLOR_PURPLE, string);
return 1;
}
}
return 1;
}
Above is just an example. It creates two strings, and gets the playername for one of them. Then it loops through all online players to see if they're nearbye, and if they are, they are sent a SendClientMessage with the players name and his action. This requires ZCMD as-well as a few stocks I added into the command. Here are the stocks:
pawn Код:
stock GetName(playerid)
{
new
pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}
stock strreplace(string[], find, replace)
{
for(new i=0; string[i]; i++)
{
if(string[i] == find)
{
string[i] = replace;
}
}
return replace;
}
stock PlayerToPlayer(playerid,targetid,Float:distance)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInRangeOfPoint(targetid,distance,x,y,z))
{
return true;
}
return false;
}
EDIT: Also, this is not the script request thread, should of posted in there instead of making a new one. This is for help when you actually tried something, which it didn't seem you did.