[FilterScript] Headshot system with helmet.
#1

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
Reply
#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
#3

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.
Reply
#4

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

Oh, I though i removed it :P
Reply
#6

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.
Reply
#7

Why so you use that (horrible) pragma?
Reply
#8

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?
Reply
#9

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)
Reply
#10

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?
Reply
#11

Your First FilterScript ?
well good work..
Reply
#12

Thanks
Reply
#13

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

Loose Intenditions. only.
Reply
#15

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.
Reply
#16

Really Good
Reply
#17

Well Great work, Good Good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)