-->
WTFCS Community | Gaming community @ since 2011
/
WTFCS - SERVERS
/
Official SAMP Servers
/
Resurse SAMP
/
Include
/
[include] AXProxDetectorEx + SendFadeMessage [UPDATE Aug. 6 2012]
[include] AXProxDetectorEx + SendFadeMessage [UPDATE Aug. 6 2012]
Author : Robotelul WtfCS,
Category : Include,
0 Replyes,
1181 Views
1 Guest(s)
08-24-2012, 02:21 PM
[Image: sdKZs.jpg]
Ce vom avea.
Cum vom folosi.
Cum functioneaza.
Culorile se vor aplica de la o culoare cu o nuanta descisa/luminata la una incisa/intunecata
Ce vom avea.
Code:
#define GetPlayerPosEx(%1,%2) GetPlayerPos(%1, %2[0], %2[1], %2[2])
#define SetPlayerPosEx(%1,%2) SetPlayerPos(%1, %2[0], %2[1], %2[2])
#define SetPlayerPosFadeEx(%1,%2,%3,%4,%5,%6) SetPlayerPosFade(%1, %2, %3, %4, %5[0], %5[1], %5[2], %6)
#define GetVehiclePosEx(%1,%2) GetVehiclePos(%1, %2[0], %2[1], %2[2])
#define SetVehiclePosEx(%1,%2) SetVehiclePos(%1, %2[0], %2[1], %2[2])
#define IsPlayerInRangeOfPointEx(%0,%1,%2) IsPlayerInRangeOfPoint(%0, %1, %2[0], %2[1], %2[2])
AXProxDetectorEx(playerid, const szMsg[], colorFrom, colorTo, float:flRadius = 50.0)
{
new float:flTargetPos[3], float:flDistance, intVirtualWorld = GetPlayerVirtualWorld(playerid);
GetPlayerPosEx(playerid, flTargetPos);
foreach (Player, i)
{
if(i == playerid)
{
SendClientMessage(playerid, colorFrom, msg);
continue;
}
if(intVirtualWorld != GetPlayerVirtualWorld(i)) continue;
flDistance = GetPlayerDistanceFromPoint(i, flTargetPos[0], flTargetPos[1], flTargetPos[2]);
SendFadeMessage(i, szMsg, colorFrom, colorTo, flDistance, flRadius);
}
return 1;
}
SendFadeMessage(playerid, const msg[], colorFrom, colorTo, Float:point, Float:radius)
{
if (0 <= point <= radius)
{
new Float:flratio = floatdiv(point, radius),
red = floatround(floatsub(((colorFrom >> 24) & 0xFF), floatmul(((colorFrom >> 24) & 0xFF), flratio))),
green = floatround(floatsub(((colorFrom >> 16) & 0xFF), floatmul(((colorFrom >> 16) & 0xFF), flratio))),
blue = floatround(floatsub(((colorFrom >> 8) & 0xFF), floatmul(((colorFrom >> 8) & 0xFF), flratio)));
if(red < ((colorTo >> 24) & 0xFF)) red = ((colorTo >> 24) & 0xFF);
if(green < ((colorTo >> 16) & 0xFF)) green = ((colorTo >> 16) & 0xFF);
if(blue < ((colorTo >> 8) & 0xFF)) blue = ((colorTo >> 8) & 0xFF);
return SendClientMessage(playerid, MK_RGB(red, green, blue), msg);
}
return -1;
}
Cum vom folosi.
Code:
#define MK_RGB(%0,%1,%2) ((%0)<<24|(%1)<<16|(%2)<<8|0xAA) // y_colours from ysi library
public OnPlayerText(playerid, text[])
{
SetPlayerChatBubble(playerid, text, X11_WHITE, 35.0, 10000);
format(text, 128, "%s(%d) says: %s", GetName(playerid), playerid, text);
AXProxDetectorEx(playerid, text, MK_RGB(190, 190, 190), MK_RGB(97, 97, 97), 35.0);
return 0;
}
Cum functioneaza.
Culorile se vor aplica de la o culoare cu o nuanta descisa/luminata la una incisa/intunecata