Member
|
01-12-2005
, 03:01
Stealth Assassin
|
#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
}
__________________
Last edited by TaRgEt*TuRkEy; 10-07-2007 at 22:15.
Reason: Code Update
|
|