SA-MP Forums Archive
[FilterScript] Headshot system with helmet. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Headshot system with helmet. (/showthread.php?tid=615570)



Headshot system with helmet. - DeeadPool - 24.08.2016

HEADSHOT SYSTEM
~ by DeeadPool


Here is my first filterscript.

Headshot system with helmets. If you have worn a helmet and some tries to headshot you, you won't die but after one hit your helmet will be gone and if you are with helmet, you will instantly die.

Commands:-
/wearhelmet ( to wear the helmet )
/removehelmet ( to remove the helmet )

Download link :-
http://pastebin.com/p1YEi37L



Re: Headshot system with helmet. - oSAINTo - 24.08.2016

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




Re: Headshot system with helmet. - DeeadPool - 24.08.2016

Quote:
Originally Posted by oSAINTo
Посмотреть сообщение
This is pretty cool, but I must say. Bodypart 9 isn't defined. Change:

TO


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:
There is no need to define bodypart 9 ( head ) it does work, it's all tested.


Re: Headshot system with helmet. - Sew_Sumi - 24.08.2016

Why do you use #DEFINE FILTERSCRIPT when you have no need to...


Re: Headshot system with helmet. - DeeadPool - 24.08.2016

Oh, I though i removed it :P


Re: Headshot system with helmet. - oSAINTo - 24.08.2016

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Why do you use #DEFINE FILTERSCRIPT when you have no need to...
You see, as a high roller, I'd assume you'd be more lenient to people like myself and OP. Instead, you're a smartass who finds the need to correct everyone in a harsh tone and not be polite and compliment how they're at least trying. More than half of the SA:MP community lays their eyes onto anything scripting related, gets confused, and lays it off. Be more considerate.


Re: Headshot system with helmet. - Infinity - 24.08.2016

Why so you use that (horrible) pragma?


Re: Headshot system with helmet. - Sew_Sumi - 24.08.2016

Quote:
Originally Posted by oSAINTo
Посмотреть сообщение
You see, as a high roller, I'd assume you'd be more lenient to people like myself and OP. Instead, you're a smartass who finds the need to correct everyone in a harsh tone and not be polite and compliment how they're at least trying. More than half of the SA:MP community lays their eyes onto anything scripting related, gets confused, and lays it off. Be more considerate.
Damn son, way to go full retard huh?


Re: Headshot system with helmet. - Stinged - 24.08.2016

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Why do you use #DEFINE FILTERSCRIPT when you have no need to...
Defining FILTERSCRIPT is very important when using includes (other than a_samp)
Most includes check if FILTERSCRIPT is defined to know what callback they should hook (ex: OnFilterScriptInit or OnGameModeInit)
So actually, he should keep it (because he's using zcmd and it uses that)


Re: Headshot system with helmet. - Arastair - 24.08.2016

Quote:
Originally Posted by oSAINTo
Посмотреть сообщение
You see, as a high roller, I'd assume you'd be more lenient to people like myself and OP. Instead, you're a smartass who finds the need to correct everyone in a harsh tone and not be polite and compliment how they're at least trying. More than half of the SA:MP community lays their eyes onto anything scripting related, gets confused, and lays it off. Be more considerate.
What?


Re: Headshot system with helmet. - Younes44 - 24.08.2016

Your First FilterScript ?
well good work..


Re: Headshot system with helmet. - DeeadPool - 24.08.2016

Thanks


Re: Headshot system with helmet. - Bolex_ - 24.08.2016

Can you please remove that pragma and show to us Errors/Warnings?


Re: Headshot system with helmet. - DeeadPool - 24.08.2016

Loose Intenditions. only.


Re: Headshot system with helmet. - Sew_Sumi - 24.08.2016

Don't use pragma to fix small errors.

Just fix the indentations.

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Defining FILTERSCRIPT is very important when using includes (other than a_samp)
Most includes check if FILTERSCRIPT is defined to know what callback they should hook (ex: OnFilterScriptInit or OnGameModeInit)
So actually, he should keep it (because he's using zcmd and it uses that)
Sure, use the #define, but using the #if relating to it is unnecessary, and more likely a remnant of using the new.pwn, same with the pragma.


Re: Headshot system with helmet. - youssef2016 - 27.08.2016

Really Good


Re: Headshot system with helmet. - LegendAbdullah - 08.03.2018

Well Great work, Good Good