Raised This Month: $94 Target: $400
 23% 

Stealth Assassin


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   twistedeuphoria (82)
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-12-2005 , 04:01   Stealth Assassin
Reply With Quote #1

This is my first plugin, and it is kind of a compilation of code from various authors (all well credited). You have the option of making knifes one hit kills, turning down knife users visibility (so they can hide), making the knife user view in third person, giving a speed boost to knife users, and gives them no footstep sounds. Most of these things are configurable with the cvars below:

Cvars:

amx_stealthvalue <0-255>
-Changes how visible you are when stealthing.

amx_stealth3rdperson <0 or 1>
-Set to 0 if you don't want players turning to third person view when using knife.

amx_stealthspeed <any>
-Set to bonus speed you want knife users to get, turn to 325 to make players go default speed (no bonus).

amx_stealthonehitkill <0 or 1>
-Switches to turn one hit knife kills off or on.

Commands:

amx_stealthmode <0 or 1>
-Switches all players to their knifes, sets to darker lighting, and drops guns if users try to switch to them.

NOTE: I cannot help that the thirdperson view does not represent your actual transparency that everyone else sees, this is set by AMXX internally, so if you don't like it, turn third person off, or set the transparency to something close to what it looks like in third person.

Have fun.

Code:
/***************************************************************
	Stealth Assassin
	Author: TaRgEt*TuRkEy (Code From Rabid Baboon & MMX)
	Version: 1.3
	Mod: Counter-Strike
	Requires: AMX Mod X v1.0 
	Description: 
		This plugin allows players to enter "stealth" when
		using the knife. Players gain the ability to lose
		visibility, enable one hit kills with knife, have
		no footstep sounds, gain extra speed, and have third 
		person view. Most of these abilities are configurable 
		with the commands.
	
	Notes:
		Thanks to Rabid Baboon and Firestorm for the one
		hit knife kills code and suicide block. Thanks
		to MMX for the invisibility code. Thanks to
		AssKicR for no footstep sounds.
		
		One Hit Knife Kills by Rabid Baboon: 
		http://amxmodx.org/forums/viewtopic.php?t=8257

		Weapon Cloak by MMX (AMX): 
		http://amxmod.net/showplugin.php?id=167518

	v1.1
		-Fixed visibility not changing back.
		-Edited message to stay as long as you have knife.
		-Added a check to see if user is alive before
		 entering stealth.
	
	v1.2	
		-Added thirdperson view when using knife (if
		 set that way).
		-Added message on channel 4 because lots of amxx
		 plugins were removing the message.
		-Added stealth match mode.
		-Using the knife now gives you a bit of an
		 additional speed boost (if set that way).

	v1.3	
		-Fixed warnings on compile.
		-Added cvar to turn one hit kill off.

	Cvars:

	amx_stealthvalue <0-255>
		-Changes how visible you are when stealthing.
	amx_stealth3rdperson <0 or 1>
		-Set to 0 if you don't want players turning to
		 third person view when using knife.
	amx_stealthspeed <any>
		-Set to bonus speed you want knife users to get,
		 turn to 325 to make players go default speed
		 (no bonus).
	amx_stealthonehitkill <0 or 1>
		-Switches to turn one hit knife kills off or on.

	Commands:

	amx_stealthmode <0 or 1>
		-Switches all players to their knifes, sets to
		 darker lighting, and drops guns if users try
	  	 to switch to them.
		
	
***************************************************************/

#include <amxmodx> 
#include <amxmisc> 
#include <fun>
#include <csx>
#include <engine>
#include <fakemeta>

new Title[32] = "Stealth Assassin"
new Version[32] = "1.3.0"
new Author[16] = "TaRgEt*TuRkEy"
new knifekill = 0
new stealthmode = 0
new roundfreeze = 1

public client_damage(attacker, victim, damage, wpnindex, hitplace, TA)
{	
	if(get_cvar_num("amx_stealthonehitkill")==1)
	{
		if(is_user_alive(victim))
		{
			if(attacker != victim) //prevents killing self with knife from fall damage.
			{
				if(wpnindex == CSW_KNIFE && TA != 1)
				{
					knifekill = 1
					if(hitplace == HIT_HEAD)
					{
						make_deathmsg(attacker, victim, 1, "knife")
					}
					else
					{
						make_deathmsg(attacker, victim, 0, "knife")
					}
					user_silentkill(victim)
					set_user_frags(attacker, get_user_frags(attacker)+1)
				}
			}
		}
	}
			
	return PLUGIN_HANDLED
}

public blocksuicide(at_type, message[])
{
	if(containi(message,"suicide") > -1 && containi(message,"world") > -1 && knifekill == 1)
	{
		knifekill = 0
		return FMRES_SUPERCEDE
	}
	return PLUGIN_CONTINUE
}  

public SetVisibility(id)
{ 
	new wepi = read_data(2)
	
	BackToNorm(id)

	if(stealthmode==1)
	{
		client_cmd(id,"weapon_knife")
	}

	if(wepi == 29) 
	{
		if(is_user_alive(id))
		AlterAlpha(id,get_cvar_num("amx_stealthvalue"))
	} else {
		BackToNorm(id)
	}
	return PLUGIN_HANDLED
}

public BackToNorm(id)
{
	set_user_footsteps(id,0)
	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255)
	set_hudmessage(200, 100, 0, -2.0, 0.20, 0, 6.0, 6.0, 0.5, 0.15, 4)
	show_hudmessage(id,"")
	set_view(id, CAMERA_NONE)
}

public AlterAlpha(id,alphaVal)
{
	new Float:maxSpeed = get_cvar_float("amx_stealthspeed")
	if(roundfreeze == 0)
	{ 	
		set_user_maxspeed(id,maxSpeed)
	}
	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,alphaVal)
	set_hudmessage(200, 100, 0, -2.0, 0.20, 0, 6.0, 99999.0, 0.5, 0.15, 4)
	show_hudmessage(id,"You are stealthing!")
	set_user_footsteps(id,1)
	if(get_cvar_num("amx_stealth3rdperson")==1)
	{
		set_view(id, CAMERA_3RDPERSON)
	}
}

public stealthmatch(id)
{
   	new arg[2]
   	read_argv(1,arg,1)
   	set_hudmessage(100, 125, 250, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2)
   	if(equal(arg,"1"))
	{
   		client_cmd(id,"weapon_knife")
		stealthmode = 1
   		show_hudmessage(0,"Stealth Mode Engaged.")
		set_lights("e")
   	} else if(equal(arg,"0")){
		stealthmode = 0
   		show_hudmessage(0,"Stealth Mode Off.")
		set_lights("m")
   	} else {
   		console_print(id,"Usage: amx_stealthmatch 1 = 0n 0 = off")
   	}
	return PLUGIN_CONTINUE
   }

public round_end()
{
	roundfreeze = 1
}

public round_start()
{
	roundfreeze = 0
}

public plugin_init() 
{ 
	register_plugin(Title,Version,Author)
	register_event("CurWeapon","SetVisibility","b","1=1")
	register_forward(FM_AlertMessage,"blocksuicide")
	register_concmd("amx_stealthmatch","stealthmatch",ADMIN_LEVEL_A,"- disable and enable stealth match 1 = on 0 = off")
	register_logevent("round_start", 2, "1=Round_Start")
	register_logevent("round_end", 2, "1=Round_End")
	register_cvar("amx_stealthvalue","120")
    	register_cvar("amx_stealthspeed","345")
	register_cvar("amx_stealthonehitkill","1")
	register_cvar("amx_stealth3rdperson","1")
	return PLUGIN_HANDLED 
}

public plugin_precache() 
{	
	//Fixes set_view bug that needs this model on map change
	precache_model("models/rpgrocket.mdl")
   	return PLUGIN_CONTINUE
}
Attached Files
File Type: sma Get Plugin or Get Source (stealthassassin.sma - 11074 views - 5.5 KB)
__________________

Last edited by TaRgEt*TuRkEy; 10-07-2007 at 23:15. Reason: Code Update
TaRgEt*TuRkEy is offline
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-12-2005 , 16:37  
Reply With Quote #2

*UPDATE* New version guys, those who downloaded please download again, I guess I should of tested better . All bugs fixed (I think).

I am also thinking of adding less and less visibility the more still you are standing, and being revealed if somebody shoots you, or bumps into you.
TaRgEt*TuRkEy is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-12-2005 , 23:10  
Reply With Quote #3

Quote:
Originally Posted by TaRgEt*TuRkEy
I am also thinking of adding less and less visibility the more still you are standing, and being revealed if somebody shoots you, or bumps into you.
Kind of like cloaking in Natural Selection?

Anyway, are you sure that client_damage will return the same id for attacker and victim if it is from fall damage? Would it return 0 (as in the world entity) as the attacker instead? Or if it is coming from a trigger_hurt would it return an attacker higher than 32 (as in the entity index)? Although client_damage may filter damage such as that because it is supposed to be called only when one player attacks another.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-13-2005 , 05:11  
Reply With Quote #4

I was wondering about this too, but when I tried it, it does filter out fall damage ONLY SOMETIMES THOUGH! I am really not sure what sets it off, but it quits working after a while. I did not write the fall damage filter part, so if you could find a better method, I would gladly add it and credit you.

I already have the next version in the works (with a stealth meter) that tells you how much you are cloaked. Standing still will make you more and more invisible, and it will take you longer to go back to default knife visibility while running after you reached maximum cloaking. May take me awhile though since I am working on multiple plugins.
TaRgEt*TuRkEy is offline
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-16-2005 , 18:19  
Reply With Quote #5

*UPDATE*
v1.2

-Added thirdperson view when using knife (if set that way).
-Added message on channel 4 because lots of amxx plugins were removing the message.
-Added stealth match mode.
-Using the knife now gives you a bit of an additional speed boost (if set that way).

---

I added alot of cvars to change whatever you want, although I will add even more for you in the next version if somebody wants, for changing footsteps, and one hit kills.

The stealthmatch mode is pretty neat, it makes the lights pretty dark (so you can stealth around), and switches back to knife (doesn't drop so you dont lose your weapons for good) if you try to bring out a gun.

I might add some user votes for that mode in the future.

NOTE: I cannot help that the thirdperson view does not represent your actual transparency that everyone else sees, this is set by AMXX internally, so if you don't like it, turn third person off, or set the transparency to something close to what it looks like in third person.
__________________
TaRgEt*TuRkEy is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-17-2005 , 18:08  
Reply With Quote #6

Good job for a first plugin , this is a great idea.
Peli is offline
Send a message via MSN to Peli
XxKpAznGuyxX
Senior Member
Join Date: Dec 2004
Location: EARTH!!
Old 01-18-2005 , 08:26  
Reply With Quote #7

is there a way you can make a certain person turn into stealth? maybe the command can be like amx_stealth (name) on
__________________
24/7 Chicago Terror-8.9.2.120:27015
XxKpAznGuyxX is offline
Send a message via AIM to XxKpAznGuyxX Send a message via MSN to XxKpAznGuyxX
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-18-2005 , 21:38  
Reply With Quote #8

No , it makes everyone stealth.
Peli is offline
Send a message via MSN to Peli
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-19-2005 , 01:33  
Reply With Quote #9

Ya there's not a real point to just make one person use this plugin, it's kind of a fun thing for everybody, try amx_stealthmatch 1 for some real fun. I had 6 players on my server with this one, very scary, it almost gave me a heart attack .
__________________
TaRgEt*TuRkEy is offline
Kryptonite
Junior Member
Join Date: Apr 2004
Old 01-23-2005 , 20:49  
Reply With Quote #10

I'm getting a bad load on this, is there anything else that needs to be running for this to work?
__________________
Paul : Kryptonite

Kryptonite is offline
Send a message via AIM to Kryptonite
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

Forum Jump


All times are GMT -4. The time now is 08:08.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode