Raised This Month: $ Target: $400
 0% 

HELP: Stealth Assassin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fabolous1
Member
Join Date: Oct 2005
Old 10-13-2005 , 12:55   HELP: Stealth Assassin
Reply With Quote #1

Code:
/* CVARS - Copy and paste into shconfig.cfg

//Stealth Assassin
sassassin_level 10			//Default 10
sassassin_getusp 1			//Default 1 - Spawn with USP
sassassin_armor 250			//Default 250
sassassin_gravity 0.50			//Default 0.50
sassassin_speed 100			//Default 100 (Slower then normal)
sassassin_knifemult 2.0			//Default 2.0
sassassin_uspmult 2.5			//Default 2.5

*/

#include <amxmod>
#include <amxmisc>
#include <superheromod>

// GLOBAL VARIABLES
new gHeroName[]="Stealth Assassin"
new bool:g_HasSassassinPower[SH_MAXSLOTS+1]
new g_Alpha


//-----------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
	register_plugin("SUPERHERO Stealth Assassin", "1.0", "Fabolous1")

	// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
	register_cvar("sassassin_level", "10")
	register_cvar("sassassin_getusp", "1")
	register_cvar("sassassin_armor", "250")
	register_cvar("sassassin_gravity", "0.50")
	register_cvar("sassassin_speed", "100")
	register_cvar("sassassin_knifemult", "2")
	register_cvar("sassassin_uspmult", "2")

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Made by: Fabolous1", "Strong USP, Knife and More", false, "sassassin_level")

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
	// INIT
	register_srvcmd("sassassin_init", "sassassin_init")
	shRegHeroInit(gHeroName, "sassassin_init")

	// EVENTS
	register_event("Damage", "sassassin_damage", "b", "2!0")
	register_event("ResetHUD", "newRound", "b")
	register_event("DeathMsg", "sassassin_death", "a")

	// Let Server know about stealthassassin's Variables
	shSetMinGravity(gHeroName, "sassassin_gravity")
	shSetMaxArmor(gHeroName, "sassassin_armor")
	shSetMaxSpeed(gHeroName, "sassassin_speed", "[0]")

}
public sassassin_init()
{
	new temp[128]
	// First Argument is an id
	read_argv(1,temp,5)
	new id=str_to_num(temp)

	// 2nd Argument is 0 or 1 depending on whether the id has stealthassassin
	read_argv(2,temp,5)
	new hasPowers=str_to_num(temp)
	g_HasSassassinPower[id]=(hasPowers!=0)

	// Got to remove the powers if he is not stealthassassin
	if ( !hasPowers )
	uninvis(id)

	//Give Powers to the stealthassassin
	if ( hasPowers )
	{
		stillInvis(id)
	}
}
public newRound(id)
{
	if ( is_user_alive(id) && g_HasSassassinPower[id]) {
		stillInvis(id)
	}
}
//----------------------------------------------------------------------------------------------
public sassassin_giveweapons(id)
{
	if ( is_user_alive(id) ) {
		shGiveWeapon(id,"weapon_usp")
	}
}
//----------------------------------------------------------------------------------------------
public sassassin_damage(id)
{
	if (!shModActive() ) return PLUGIN_CONTINUE
	new damage = read_data(2)
	new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)

	if ( attacker <=0 || attacker>SH_MAXSLOTS ) return PLUGIN_CONTINUE

	if ( g_HasSassassinPower[attacker] && weapon == CSW_KNIFE && is_user_alive(id) )
	{
		// do extra damage
		new extraDamage = floatround(damage * get_cvar_float("sassassin_knifemult") - damage)
		shExtraDamage( id, attacker, extraDamage, "Super Knife" )
	}
	if ( g_HasSassassinPower[attacker] && weapon == CSW_USP && is_user_alive(id) )
	{
		// do extra damage
		new extraDamage = floatround(damage * get_cvar_float("sassassin_uspmult") - damage)
		shExtraDamage(id, attacker, extraDamage, "usp")
	}
	return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public stillInvis(id) {
	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,20)
}

public moveInvis(id) {
	new g_Alpha = get_cvar_num("sassassin_alpha")

	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,g_Alpha)
}

public uninvis(id) {
	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,g_Alpha)
}
//----------------------------------------------------------------------------------------------
public sassassin_loop() {
	for ( new id=1; id<=SH_MAXSLOTS; id++ ) {
		if (g_HasSAssassinPower[id] && is_user_alive(id)) {
			new message[128]
			format(message,127,"Invisibility: %invis", g_Alpha)
			set_hudmessage(0,0,255,-1.0,1.0,0,1.0,1.0,0.0,0.0,4)
			show_hudmessage(id,message)
		}
	}
}
//----------------------------------------------------------------------------------------------
Hey everyone, I know this seems like a rip atm but I plan to add more different features once I get this part of the hero working, this is my first hero ever so I consider it training for me, please.

I'm having problems with:
1. Wanting it to say "Invisibility: [percent]" At the bottom of the screen in gameplay
2. Spawning with a USP
3. For some reason it's a +power, I don't want it to be.
4. Also if I compile it myself for amx, I get errors

Thank you, Fab
__________________
Fabolous1 is offline
Send a message via AIM to Fabolous1
Mega
Senior Member
Join Date: Aug 2005
Old 10-13-2005 , 14:28  
Reply With Quote #2

Change this
Code:
   // FIRE THE EVENT TO CREATE THIS SUPERHERO!
   shCreateHero(gHeroName, "Strong USP & Knife", "Protective Stealth Armor, Cloak of Levitation.", true, "sassassin_level")
To This
Code:
   // FIRE THE EVENT TO CREATE THIS SUPERHERO!
   shCreateHero(gHeroName, "Strong USP & Knife", "Protective Stealth Armor, Cloak of Levitation.", false, "sassassin_level")
Mega is offline
Fabolous1
Member
Join Date: Oct 2005
Old 10-13-2005 , 15:37  
Reply With Quote #3

Okay thanks, how do I make it so I get silent footsteps, and so it will show my Invisibility percent at bottom of screen
__________________
Fabolous1 is offline
Send a message via AIM to Fabolous1
Fabolous1
Member
Join Date: Oct 2005
Old 10-14-2005 , 22:12  
Reply With Quote #4

Now I'm working with that updated code, but I have to add silent footsteps, get invisibility working, and showing invisibility percent at bottom of screen. Can someone please help me out here, this is my first hero heh
__________________
Fabolous1 is offline
Send a message via AIM to Fabolous1
craze
Junior Member
Join Date: Oct 2005
Old 10-14-2005 , 22:23  
Reply With Quote #5

for silent footsteps, try this...

Change this
Code:
public sassassin_init()
{
   new temp[128]
   // First Argument is an id
   read_argv(1,temp,5)
   new id=str_to_num(temp)

   // 2nd Argument is 0 or 1 depending on whether the id has stealthassassin
   read_argv(2,temp,5)
   new hasPowers=str_to_num(temp)
   g_HasSassassinPower[id]=(hasPowers!=0)

   // Got to remove the powers if he is not stealthassassin
   if ( !hasPowers )
   uninvis(id)

   //Give Powers to the stealthassassin
   if ( hasPowers )
   {
      stillInvis(id)
   }
}
public newRound(id)
{
   if ( is_user_alive(id) && g_HasSassassinPower[id]) {
      stillInvis(id)
   }
}
//----------------------------------------------------------------------------------------------
to this:

Code:
public sassassin_init()
{
   new temp[128]
   // First Argument is an id
   read_argv(1,temp,5)
   new id=str_to_num(temp)

   // 2nd Argument is 0 or 1 depending on whether the id has stealthassassin
   read_argv(2,temp,5)
   new hasPowers=str_to_num(temp)
   g_HasSassassinPower[id]=(hasPowers!=0)

   // Got to remove the powers if he is not stealthassassin
   if ( !hasPowers ){
   uninvis(id)
   set_user_footsteps(id,0)
   }

   //Give Powers to the stealthassassin
   if ( hasPowers )
   {
      stillInvis(id)
      set_user_footsteps(id,1)
   }
}
public newRound(id)
{
   if ( is_user_alive(id) && g_HasSassassinPower[id]) {
      stillInvis(id)
      set_user_footsteps(id,1)
   }
}
//----------------------------------------------------------------------------------------------
I just added in some lines from windwalkers code. The line is:
Code:
set_user_footsteps(id,0)
. I'm not sure if it will work, but it's worth a shot. good luck!
craze is offline
Send a message via AIM to craze Send a message via MSN to craze
Fabolous1
Member
Join Date: Oct 2005
Old 10-14-2005 , 23:23  
Reply With Quote #6

Okay, I'm using ::

Code:
/* CVARS - Copy and paste into shconfig.cfg

//Stealth Assassin
sassassin_level 10			//Default 10
sassassin_getusp 1			//Default 1 - Spawn with USP
sassassin_armor 250			//Default 250
sassassin_gravity 0.50			//Default 0.50
sassassin_speed 100			//Default 100 (Slower then normal)
sassassin_knifemult 2.0			//Default 2.0
sassassin_uspmult 2.0			//Default 2.0

*/

#include <amxmod>
#include <amxmisc>
#include <superheromod>

// GLOBAL VARIABLES
new gHeroName[]="Stealth Assassin"
new bool:g_HasSassassinPower[SH_MAXSLOTS+1]
new g_Alpha


//-----------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
	register_plugin("SUPERHERO Stealth Assassin", "1.0", "Fabolous1")

	// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
	register_cvar("sassassin_level", "10")
	register_cvar("sassassin_getusp", "1")
	register_cvar("sassassin_armor", "250")
	register_cvar("sassassin_gravity", "0.50")
	register_cvar("sassassin_speed", "100")
	register_cvar("sassassin_knifemult", "2")
	register_cvar("sassassin_uspmult", "2")

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Made by: Fabolous1", "Strong USP, Knife and More", false, "sassassin_level")

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
	// INIT
	register_srvcmd("sassassin_init", "sassassin_init")
	shRegHeroInit(gHeroName, "sassassin_init")

	// EVENTS
	register_event("Damage", "sassassin_damage", "b", "2!0")
	register_event("ResetHUD", "newRound", "b")
	register_event("DeathMsg", "sassassin_death", "a")

	// Let Server know about stealthassassin's Variables
	shSetMinGravity(gHeroName, "sassassin_gravity")
	shSetMaxArmor(gHeroName, "sassassin_armor")
	shSetMaxSpeed(gHeroName, "sassassin_speed", "[0]")

}
//----------------------------------------------------------------------------------------------
public sassassin_init() 
{ 
   new temp[128] 
   // First Argument is an id 
   read_argv(1,temp,5) 
   new id=str_to_num(temp) 

   // 2nd Argument is 0 or 1 depending on whether the id has stealthassassin 
   read_argv(2,temp,5) 
   new hasPowers=str_to_num(temp) 
   g_HasSassassinPower[id]=(hasPowers!=0) 

   // Got to remove the powers if he is not stealthassassin 
   if ( !hasPowers ){ 
   uninvis(id) 
   set_user_footsteps(id,0) 
   } 

   //Give Powers to the stealthassassin 
   if ( hasPowers ) 
   { 
      stillInvis(id) 
      set_user_footsteps(id,1) 
   } 
} 
public newRound(id) 
{ 
   if ( is_user_alive(id) && g_HasSassassinPower[id]) { 
      stillInvis(id) 
      set_user_footsteps(id,1) 
   } 
}
//----------------------------------------------------------------------------------------------
public sassassin_giveweapons(id)
{
	if ( is_user_alive(id) ) {
		shGiveWeapon(id,"weapon_usp")
	}
}
//----------------------------------------------------------------------------------------------
public sassassin_damage(id)
{
	if (!shModActive() ) return PLUGIN_CONTINUE
	new damage = read_data(2)
	new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)

	if ( attacker <=0 || attacker>SH_MAXSLOTS ) return PLUGIN_CONTINUE

	if ( g_HasSassassinPower[attacker] && weapon == CSW_KNIFE && is_user_alive(id) )
	{
		// do extra damage
		new extraDamage = floatround(damage * get_cvar_float("sassassin_knifemult") - damage)
		shExtraDamage( id, attacker, extraDamage, "Super Knife" )
	}
	if ( g_HasSassassinPower[attacker] && weapon == CSW_USP && is_user_alive(id) )
	{
		// do extra damage
		new extraDamage = floatround(damage * get_cvar_float("sassassin_uspmult") - damage)
		shExtraDamage(id, attacker, extraDamage, "usp")
	}
	return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public stillInvis(id) {
	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,20)
}

public moveInvis(id) {
	new g_Alpha = get_cvar_num("sassassin_alpha")

	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,g_Alpha)
}

public uninvis(id) {
	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,g_Alpha)
}
//----------------------------------------------------------------------------------------------
public sassassin_loop() {
	for ( new id=1; id<=SH_MAXSLOTS; id++ ) {
		if (g_HasSAssassinPower[id] && is_user_alive(id)) {
			new message[128]
			format(message,127,"Invisibility: %invis", g_Alpha)
			set_hudmessage(0,0,255,-1.0,1.0,0,1.0,1.0,0.0,0.0,4)
			show_hudmessage(id,message)
		}
	}
}
//----------------------------------------------------------------------------------------------
And I'm Getting These Errors

Code:
sh_sassassin.sma(74) : error 017: undefined symbol "set_user_footsteps"
sh_sassassin.sma(81) : error 017: undefined symbol "set_user_footsteps"
sh_sassassin.sma(88) : error 017: undefined symbol "set_user_footsteps"
sh_sassassin.sma(127) : warning 219: local variable "g_Alpha" shadows a variable at a preceding level
sh_sassassin.sma(138) : error 017: undefined symbol "g_HasSAssassinPower"
sh_sassassin.sma(138) : warning 215: expression has no effect
sh_sassassin.sma(138) : error 001: expected token: ";", but found "]"
sh_sassassin.sma(138) : error 029: invalid expression, assumed zero
sh_sassassin.sma(138) : fatal error 107: too many error messages on one line

Compilation aborted.Small compiler 2.6.0		Copyright (c) 1997-2004, ITB CompuPhase


7 Errors.
__________________
Fabolous1 is offline
Send a message via AIM to Fabolous1
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 10-14-2005 , 23:30  
Reply With Quote #7

code for amxx and it would work a lot better since set_user_footsteps is not available in AMX 0.9.9
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
v_one
Junior Member
Join Date: Oct 2005
Old 10-15-2005 , 00:20  
Reply With Quote #8

or try adding a PreThink function.
Code:
//------------------------------------------------------------------------- public client_prethink(id) {     if(gHasWindWalker[id]) {         Entvars_Set_Int(id, EV_INT_flTimeStepSound, 999)     } } #else     if ( !hasPowers && is_user_connected(id) ) {         set_user_footsteps(id,0)     }     if ( hasPowers && is_user_connected(id) ) {         set_user_footsteps(id,1)     } } //-------------------------------------------------------------------------

And define
Code:
#if defined AMX_NEW     #include <Vexd_Utilities> #endif #if defined AMX98     #include <xtrafun> #endif
for your includes.
v_one is offline
Fabolous1
Member
Join Date: Oct 2005
Old 10-15-2005 , 16:01  
Reply With Quote #9

Weeee, I finally converted my server to AMXX
__________________
Fabolous1 is offline
Send a message via AIM to Fabolous1
Reply



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 00:33.


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