PHP код:
CMD:try(playerid, params[])
{
if(isnull(params))
return SendClientMessage(playerid, -1, !"Используйте: /try [действие]");
const
SUCCESS_STR_LENGTH = 20;
static const
success_strings[2][(SUCCESS_STR_LENGTH + 1) char] =
{
!" {1CEF00}| Удачно",
!" {FF0000}| Не удачно"
};
goto skip_string_init;
new
string[MAX_CHATBUBBLE_LENGTH + 1];
skip_string_init:
new
len = GetPlayerName(playerid, string, sizeof(string));
string[len] = ' ', string[len + 1] = EOS;
strcat(string, params);
string[sizeof(string) - len - SUCCESS_STR_LENGTH] = EOS;
strcat(string, success_strings[random(2)]);
new
player_world = GetPlayerVirtualWorld(playerid),
player_int = GetPlayerInterior(playerid),
Float: player_pos_x,
Float: player_pos_y,
Float: player_pos_z;
GetPlayerPos(playerid, player_pos_x, player_pos_y, player_pos_z);
#if defined foreach
foreach(new i : Player) if(
#else
for (new i = GetPlayerPoolSize()+1; i-- != 0;) if(IsPlayerConnected(i))
#endif
if(player_world == GetPlayerVirtualWorld(i)
&& player_int == GetPlayerInterior(i)
&& IsPlayerInRangeOfPoint(i, 10.0, player_pos_x, player_pos_y, player_pos_z))
SendClientMessage(i, 0xDD90FFFF, string);
return 1;
}