SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 24/08/2016, 05:14 AM   #1
DeeadPool
Big Clucker
 
Join Date: Mar 2016
Posts: 144
Reputation: 8
Default Headshot system with helmet.

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
DeeadPool is offline   Reply With Quote
Old 24/08/2016, 05:20 AM   #2
oSAINTo
Huge Clucker
 
oSAINTo's Avatar
 
Join Date: Aug 2015
Posts: 220
Reputation: 35
Default Re: Headshot system with helmet.

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
oSAINTo is offline   Reply With Quote
Old 24/08/2016, 05:23 AM   #3
DeeadPool
Big Clucker
 
Join Date: Mar 2016
Posts: 144
Reputation: 8
Default Re: Headshot system with helmet.

Quote:
Originally Posted by oSAINTo View Post
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.
DeeadPool is offline   Reply With Quote
Old 24/08/2016, 06:04 AM   #4
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,212
Reputation: 515
Default Re: Headshot system with helmet.

Why do you use #DEFINE FILTERSCRIPT when you have no need to...
Sew_Sumi is online now   Reply With Quote
Old 24/08/2016, 06:11 AM   #5
DeeadPool
Big Clucker
 
Join Date: Mar 2016
Posts: 144
Reputation: 8
Default Re: Headshot system with helmet.

Oh, I though i removed it :P
DeeadPool is offline   Reply With Quote
Old 24/08/2016, 06:14 AM   #6
oSAINTo
Huge Clucker
 
oSAINTo's Avatar
 
Join Date: Aug 2015
Posts: 220
Reputation: 35
Default Re: Headshot system with helmet.

Quote:
Originally Posted by Sew_Sumi View Post
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.
oSAINTo is offline   Reply With Quote
Old 24/08/2016, 06:26 AM   #7
Infinity
High-roller
 
Infinity's Avatar
 
Join Date: Jul 2009
Posts: 1,538
Reputation: 975
Default Re: Headshot system with helmet.

Why so you use that (horrible) pragma?
__________________

I apologize for the stupidity of my fellow members

Quote:
Originally Posted by !damo!spiderman View Post
Stand for something that's going to help the world rather than fill it with more hate. Give someone a hug, tell someone you care... Do something, do anything but do it with love not hate.
Infinity is offline   Reply With Quote
Old 24/08/2016, 07:49 AM   #8
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,212
Reputation: 515
Default Re: Headshot system with helmet.

Quote:
Originally Posted by oSAINTo View Post
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?
__________________
Quote:
Originally Posted by Random View Post
this gamemode is so out of date and it isn't even comparable with todays other servers.
just because brain tricks us thinking that old days gamemodes were better then its just wrong, because funcinality was so poor, building new systems was very time consuming, because scripters didn't understand how to make gamemode to parts and simplify their work.
Jesus, that's a load of crap...

Quote:
Originally Posted by Crystallize
quote my big balls then
You must be looking at life through a microscope then, and not a tunnel as I had previously thought...

Quote:
Originally Posted by AnotherRandom
I've seen threads where you make random brainstorms.
Pointing out larger issues with peoples code, and getting information about what is going on that could be causing issues elsewhere, is a sure way of actually getting the right information. Not just fixing the symptom, that will show up later as they try to expand.
Sew_Sumi is online now   Reply With Quote
Old 24/08/2016, 08:34 AM   #9
Stinged
High-roller
 
Join Date: Feb 2013
Posts: 1,590
Reputation: 187
Default Re: Headshot system with helmet.

Quote:
Originally Posted by Sew_Sumi View Post
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)
Stinged is offline   Reply With Quote
Old 24/08/2016, 09:00 AM   #10
Arastair
Gangsta
 
Join Date: Jun 2014
Posts: 830
Reputation: 49
Default Re: Headshot system with helmet.

Quote:
Originally Posted by oSAINTo View Post
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?
__________________
"War does not determine who is right... only who is left"
Arastair is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Advance Helmet with Headshot System. MBilal Filterscripts 3 22/12/2015 04:50 PM
[FilterScript] Helmet System (5 Random Helmets!) SyntaxQ Filterscripts 1 08/03/2014 03:14 AM
Helmet system Scott Zulkifli Scripting Help 1 28/10/2012 07:04 AM
[FilterScript] New Helmet System Shane_Kingston Filterscripts 3 24/10/2012 12:56 PM


All times are GMT. The time now is 09:47 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.