/hi - пожать руку (доработано)
Код:
CMD:hi(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, 0x999999FF, "Нельзя использовать в машине");
if(!strlen(params))
return SendClientMessage(playerid, 0xCECECEFF, "Используйте: /hi [id игрока]");
extract params -> new to_player;
if(!IsPlayerConnected(to_player) || !IsPlayerLogged(to_player) || to_player == playerid)
return SendClientMessage(playerid, 0x999999FF, "Такого игрока нет");
new Float: to_x, Float: to_y, Float: z;
GetPlayerPos(to_player, to_x, to_y, z);
new Float: dist = GetPlayerDistanceFromPoint(playerid, to_x, to_y, z);
if(0.5 <= dist <= 1.5)
{
SendPlayerOffer(playerid, to_player, OFFER_TYPE_HANDSHAKE);
}
else if(dist < 25.0)
{
new fmt_str[35];
new Float: x, Float: y;
new Float: angle;
GetPlayerPos(playerid, x, y, z);
angle = GetAngleToPoint(to_x, to_y, x, y);
SetPlayerFacingAngle(playerid, angle);
format(fmt_str, sizeof fmt_str,"машет рукой %s", GetPlayerNameEx(to_player));
Action(playerid, fmt_str, _, false);
ApplyAnimation(playerid, "PED", "endchat_03", 4.1, 0, 1, 1, 0, 0, 1);
}
else SendClientMessage(playerid, 0x999999FF, "Вы находитесь слишком далеко от игрока");
return 1;
}