[FilterScript] Headshot system with helmet.
#2

This is pretty cool, but I must say. Bodypart 9 isn't defined. Change:
Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if( GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))
{
if(weaponid == 34 && bodypart == 9)
{
if(Helmet[playerid] == 1)
{
Helmet[playerid] = 0;
SendClientMessage(playerid, -1, "Your helmet has absorbed the sniper bullet and you have delt no damage!");
RemovePlayerAttachedObject(playerid, 1);
}
else
{
SetPlayerHealth(playerid, 0);
GameTextForPlayer(playerid, "~r~Headshot!", 5000, 2);
}
}
}
return 1;
}

TO
Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if( GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))
{
if(weaponid == 34 && bodypart == BODY_PART_HEAD)
{
if(Helmet[playerid] == 1)
{
Helmet[playerid] = 0;
SendClientMessage(playerid, -1, "Your helmet has absorbed the sniper bullet and you have delt no damage!");
RemovePlayerAttachedObject(playerid, 1);
}
else
{
SetPlayerHealth(playerid, 0);
GameTextForPlayer(playerid, "~r~Headshot!", 5000, 2);
}
}
}
return 1;
}

ALSO
This is only for a sniper-rifle? If so, announce that.

Since OnFilterScriptInit & OnFilterScriptExit do nothing to the script itself, you can get rid of 16 lines of not needed code. Delete:
Quote:

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Headshot system by Deeadpool");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}


#endif

Reply


Messages In This Thread
Headshot system with helmet. - by DeeadPool - 24.08.2016, 05:14
Re: Headshot system with helmet. - by oSAINTo - 24.08.2016, 05:20
Re: Headshot system with helmet. - by DeeadPool - 24.08.2016, 05:23
Re: Headshot system with helmet. - by Sew_Sumi - 24.08.2016, 06:04
Re: Headshot system with helmet. - by DeeadPool - 24.08.2016, 06:11
Re: Headshot system with helmet. - by oSAINTo - 24.08.2016, 06:14
Re: Headshot system with helmet. - by Infinity - 24.08.2016, 06:26
Re: Headshot system with helmet. - by Sew_Sumi - 24.08.2016, 07:49
Re: Headshot system with helmet. - by Stinged - 24.08.2016, 08:34
Re: Headshot system with helmet. - by Arastair - 24.08.2016, 09:00
Re: Headshot system with helmet. - by Younes44 - 24.08.2016, 09:05
Re: Headshot system with helmet. - by DeeadPool - 24.08.2016, 09:13
Re: Headshot system with helmet. - by Bolex_ - 24.08.2016, 09:43
Re: Headshot system with helmet. - by DeeadPool - 24.08.2016, 09:50
Re: Headshot system with helmet. - by Sew_Sumi - 24.08.2016, 10:33
Re: Headshot system with helmet. - by youssef2016 - 27.08.2016, 22:59
Re: Headshot system with helmet. - by LegendAbdullah - 08.03.2018, 11:30

Forum Jump:


Users browsing this thread: 1 Guest(s)