25.01.2015, 13:51
try this one , i think it will work , not sure though
pawn Код:
stock HeadshotCheck(playerid, &Float:x, &Float:y, &Float:z)
{
new Float:fx,Float:fy,Float:fz;
GetPlayerCameraFrontVector(playerid, fx, fy, fz);
new Float:cx,Float:cy,Float:cz;
GetPlayerCameraPos(playerid, cx, cy, cz);
for(new Float:i = 0.0; i < 50; i = i + 0.5)
{
x = fx * i + cx;
y = fy * i + cy;
z = fz * i + cz;
#if defined SHOWPATH
CreatePickup(1239, 4, x, y, z, -1);
#endif
for(new player = 0; player < SERVER_MAX_PLAYERS; player ++)
{
if(IsPlayerConnected(playerid))
{
if(player != playerid)
{
if(GetPlayerTeam(player) != GetPlayerTeam(playerid))
{
if(GetPlayerSpecialAction(player) == SPECIAL_ACTION_DUCK)
{
if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z))
{
GameTextForPlayer(player, "~r~Head Shot!", 2000, 2);
SetPlayerHealth(player, 0.0);
CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
}
}
}
else
{
if(GetPlayerTeam(player) != GetPlayerTeam(playerid))
{
if(IsPlayerInRangeOfPoint(player, 0.3, x, y, z - 0.7))
{
GameTextForPlayer(player, "~r~Head Shot!", 2000, 2);
SetPlayerHealth(player, 0.0);
CallRemoteFunction("OnPlayerDeath", "ddd", player, playerid, 34);
}
}
}
}
}
}
}
return 1;
}