Sei.. Segue o cуdigo
pawn Код:
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/* Include */
#include <a_samp>
/* New's */
new tima[MAX_PLAYERS];
new Text: ____[MAX_PLAYERS];
/* Forward */
forward Float:GetDistanceBetweenPlayers(p1,p2);
forward Faus(playerid);
/*============================================================================*/
public OnFilterScriptInit()
{
for (new i = 0; i < GetMaxPlayers(); i++)
{
if (IsPlayerConnected(i))
{
tima[i] = SetTimerEx("Faus", 750, 1, "d", i);
____[i] = TextDrawCreate(300, 300, "-");
TextDrawAlignment(____[i], 0);
TextDrawBackgroundColor(____[i], 0x000000ff);
TextDrawFont(____[i], 2);
TextDrawLetterSize(____[i], 0.3, 1.100000);
TextDrawColor(____[i], 0xffffffff);
TextDrawSetOutline(____[i], 1);
TextDrawSetProportional(____[i], 1);
TextDrawSetShadow(____[i], 1);
}
}
return 1;
}
/*============================================================================*/
public OnFilterScriptExit()
{
for (new i = 0; i < GetMaxPlayers(); i++)
{
if (IsPlayerConnected(i))
{
KillTimer(tima[i]);
TextDrawHideForPlayer(i, ____[i]);
TextDrawDestroy(____[i]);
}
}
return 1;
}
/*============================================================================*/
public OnPlayerConnect(playerid)
{
____[playerid] = TextDrawCreate(406, 307, "PREVED");
TextDrawAlignment(____[playerid], 0);
TextDrawBackgroundColor(____[playerid], 0x000000ff);
TextDrawFont(____[playerid], 2);
TextDrawLetterSize(____[playerid], 0.3, 1.100000);
TextDrawColor(____[playerid], 0xffffffff);
TextDrawSetOutline(____[playerid], 1);
TextDrawSetProportional(____[playerid], 1);
TextDrawSetShadow(____[playerid], 1);
tima[playerid] = SetTimerEx("Faus", 750, 1, "d", playerid);
return 1;
}
/*============================================================================*/
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, ____[playerid]);
TextDrawDestroy(____[playerid]);
KillTimer(tima[playerid]);
return 1;
}
/*============================================================================*/
public Faus(playerid)
{
new string[128];
new Float: x,
Float: y,
Float: z;
for (new i = 0; i < GetMaxPlayers(); i++)
{
if (IsPlayerAiming(playerid, i) && GetPlayerWeapon(playerid) == 34 && i != playerid)
{
GetPlayerPos(i, x, y, z);
format(string, 128, "~g~%s dist: ~r~%d m.~n~~b~Ping: ~r~%dms~n~~g~AMSL: ~r~%d m.~n~~b~Arma: ~r~%s~p~(%d)", LOL(GetName(i)), floatround(GetDistanceBetweenPlayers(i, playerid)), GetPlayerPing(i), floatround(z), ReturnWeaponName(GetPlayerWeapon(i)), GetPlayerAmmo(i));
TextDrawSetString(____[playerid], string);
TextDrawShowForPlayer(playerid, ____[playerid]);
}
}
return 1;
}
/*============================================================================*/
LOL(string[])
{
new result[256];
for (new i; i < 256; i++)
{
switch (string[i])
{
case '[':
result[i] = '(';
case ']':
result[i] = ')';
default:
result[i] = string[i];
}
}
return result;
}
/*============================================================================*/
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (oldkeys == 128)
{
TextDrawHideForPlayer(playerid, ____[playerid]);
}
return 1;
}
/*============================================================================*/
ReturnWeaponName(weaponid)
{
new weaponname[256];
GetWeaponName(weaponid, weaponname, sizeof(weaponname));
return weaponname;
}
/*============================================================================*/
/* Storks*/
stock IsPlayerAiming(playerid, aimid)
{
new Float: X1,
Float: Y1,
Float: Z1,
Float: X2,
Float: Y2,
Float: Z2;
GetPlayerPos(playerid, X1, Y1, Z1);
GetPlayerPos(aimid, X2, Y2, Z2);
new Float: Distance = floatsqroot(floatpower(floatabs(X1 - X2), 2) + floatpower(floatabs(Y1 - Y2), 2));
if (Distance < 100)
{
new Float: A;
GetPlayerFacingAngle(playerid, A);
X1 += (Distance * floatsin(-A, degrees));
Y1 += (Distance * floatcos(-A, degrees));
Distance = floatsqroot(floatpower(floatabs(X1 - X2), 2) + floatpower(floatabs(Y1 - Y2), 2));
if (Distance < 1.3)
{
return true;
}
}
return false;
}
/*============================================================================*/
stock Float: GetDistanceBetweenPlayers(p1, p2)
{
new Float: x11,
Float: y11,
Float: z11,
Float: x3,
Float: y3,
Float: z3;
if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1, x11, y11, z11);
GetPlayerPos(p2, x3, y3, z3);
return floatsqroot(floatpower(floatabs(floatsub(x3, x11)), 2) + floatpower(floatabs(floatsub(y3, y11)), 2) + floatpower(floatabs(floatsub(z3, z11)), 2));
}
/*============================================================================*/
stock GetName(playerid)
{
new Name[256];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
return Name;
}
/*============================================================================*/