21.07.2010, 20:53
Here is the code im using:
That goes under OnPlayerKeyStateChange..
This is the function:
Well right now im stucked with that, cause SOMEONE deleted Seif_'s account and well the file went with it.
So yeah, when i shoot someone near the head with sniper, it won't instant kill him. any suggestions?
btw, ignore the Sendnews... thats on my script, not related to the HeadShot function.
pawn Код:
if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE)
{
if(GetPlayerWeapon(playerid) == 34)
{
new Float:HSX, Float:HSY, Float:HSZ;
return HeadshotCheck(playerid, HSX, HSY, HSZ);
}
return 1;
}
This is the function:
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;
CreatePickup(1239, 4, X, Y, Z, -1);
foreach(Player,player)
{
if(IsPlayerInRangeOfPoint(player, 0.3, X, Y, Z - 0.7))
{
if(player != playerid)
{
format(Msg, sizeof(Msg), "HEADSHOT: \"%s\" Was Shot By \"%s\"", pName(player), pName(playerid));
SetPlayerHealth(player, 0.0);
SendNewsMessage(COLOR_IVORY,Msg);
}
}
}
}
return 1;
}
So yeah, when i shoot someone near the head with sniper, it won't instant kill him. any suggestions?
btw, ignore the Sendnews... thats on my script, not related to the HeadShot function.