28.09.2010, 12:16
(
Последний раз редактировалось mmrk; 28.09.2010 в 12:34.
)
This looks better?
foreach, zcmd and sscanf
foreach, zcmd and sscanf
pawn Код:
stock ProxDetector(Float:radi, playerid, string[], color)
{
new Float:posx, Float:posy, Float:posz;
GetPlayerPos(playerid, posx, posy, posz);
foreach (Player, i)
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
if(IsPlayerInRangeOfPoint(i,radi,posx, posy, posz))
{
SendClientMessage(i, color, string);
}
}
}
}
stock SendDoingMessage(playerid, doing[])
{
new Float: emoteX, Float: emoteY, Float: emoteZ, playerName[MAX_PLAYER_NAME], msg[128];
GetPlayerPos(playerid, emoteX, emoteY, emoteZ);
GetPlayerName(playerid, playerName, sizeof(playerName));
format(msg, sizeof(msg), "* %s %s", playerName, doing);
ProxDetector(30.0, playerid, msg, COLOR_PURPLE);
return 1;
}
CMD:me(playerid, params[])
{
new result[128];
if(sscanf(params, "s[128]", result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [text]");
return SendDoingMessage(playerid, result);
}