Jelles SH
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Jelles SH

Jelles forum.
 
HomeLatest imagesSearchRegisterLog in

 

 Hero: Itachi

Go down 
AuthorMessage
Jelle
Awesome Jelle!!!
Awesome Jelle!!!
Jelle


Posts : 30
Join date : 2009-09-16
Age : 33
Location : Jelles Superhero Server

Hero: Itachi Empty
PostSubject: Hero: Itachi   Hero: Itachi EmptyFri Oct 09, 2009 3:47 pm

This hero was made for a friend called Itachi. This hero is admin only. It has a blast like master blaster has. Change the name if you want.

Quote :

/* CVARS - copy and paste to shconfig.cfg

//Itachi
itachi_level 8
itachi_gravity 0.35 //Gravity Itachi has
itachi_ak47mult 2.0 //Damage multiplyer for his ak47
itachi_health 250 //Health
itachi_armor 250 //Armor
itachi_cooldown 30 //Cooldown timer between shots in seconds
itachi_maxdamage 100 //Max Damage from blast
itachi_radius 75 //Radius of blast
itachi_blast_decals 1 //Show the burn decals on the walls

*/

#include
#include
#include

// VARIABLES
new gHeroName[]="Itachi"
new gHasItachiPower[SH_MAXSLOTS+1]
new gLastWeapon[SH_MAXSLOTS+1]
new bool:gItachiSelected[SH_MAXSLOTS+1]
new Beam, Fire
static const burn_decal[3] = {28, 29, 30}
static const burn_decal_big[3] = {46, 47, 48}
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Itachi","1.0","Jelle")

// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("itachi_level", "8")
register_cvar("itachi_gravity", "0.35" )
register_cvar("itachi_ak47mult", "2")
register_cvar("itachi_health", "250")
register_cvar("itachi_armor", "250")
register_cvar("itachi_cooldown", "30")
register_cvar("itachi_maxdamage", "100")
register_cvar("itachi_radius", "75")
register_cvar("itachi_blast_decals", "1")


// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(gHeroName, "Itachi Power!", "A exoplisive blast plus a nice colt along with the blast", true, "itachi_level" )

// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)

// INIT
register_srvcmd("itachi_init", "itachi_init")
shRegHeroInit(gHeroName, "itachi_init")

register_event("ResetHUD", "newSpawn","b")
register_event("CurWeapon", "weaponChange","be","1=1")
register_event("Damage", "itachi_damage","b","2!0")

//KEY DOWN
register_srvcmd("itachi_kd", "itachi_kd")
shRegKeyDown(gHeroName, "itachi_kd")

//KEY UP
register_srvcmd("itachi_ku", "itachi_ku")
shRegKeyUp(gHeroName, "itachi_ku")

register_event("ResetHUD", "newSpawn", "b")

// Let Server know about Master Blaster's Variable
shSetMinGravity(gHeroName, "itachi_gravity" )
shSetShieldRestrict(gHeroName)
shSetMaxHealth(gHeroName, "itachi_health" )
shSetMaxArmor(gHeroName, "itachi_armor" )
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model("models/shmod/itachi_ak47.mdl")
Beam = precache_model("sprites/zbeam5.spr")
Fire = precache_model("sprites/xfireball3.spr")
precache_model("models/player/itachi/itachi.mdl")
}
//----------------------------------------------------------------------------------------------
public itachi_init()
{
// First Argument is an id
new temp[6]
read_argv(1,temp,5)
new id=str_to_num(temp)

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

gHasItachiPower[id] = (hasPowers != 0)
gItachiSelected[id] = gHasItachiPower[id]

if ( !gHasItachiPower[id] && is_user_alive(id) ) {
shRemHealthPower(id)
shRemArmorPower(id)
}
//Reset thier shield restrict status
//Shield restrict MUST be before weapons are given out
shResetShield(id)

if ( !is_user_alive(id) ) return

if ( gHasItachiPower[id] ) {
itachi_weapons(id)
switchmodel(id)
itachi_admincheck(id)
}
else {
engclient_cmd(id,"drop","weapon_ak47")
shRemGravityPower(id)
}
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
if ( gHasItachiPower[id] && is_user_alive(id) && shModActive() ) {
set_task(0.1, "itachi_weapons", id)

new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid != CSW_AK47 && wpnid > 0) {
new wpn[32]
get_weaponname(wpnid,wpn,31)
engclient_cmd(id,wpn)
}
}
}
//----------------------------------------------------------------------------------------------
public itachi_weapons(id)
{
if ( is_user_alive(id) && shModActive() ) {
shGiveWeapon(id,"weapon_ak47")
}
}
//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
if ( !is_user_alive(id) || !gHasItachiPower[id] ) return
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid == CSW_AK47) {
// Weapon Model change thanks to [CCC]Taz-Devil
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/itachi_ak47.mdl")
cs_set_user_model(id, "itachi.mdl");
}

}
//----------------------------------------------------------------------------------------------
public weaponChange(id)
{
if ( !gHasItachiPower[id] || !shModActive() ) return

//new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
new wpnid = read_data(2)
new clip = read_data(3)

if ( wpnid != CSW_AK47 ) return

switchmodel(id)

// Never Run Out of Ammo!
if ( clip == 0 ) {
shReloadAmmo(id)
}
}
//----------------------------------------------------------------------------------------------
public itachi_damage(id)
{
if (!shModActive() || !is_user_alive(id)) return

new damage = read_data(2)
new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
new headshot = bodypart == 1 ? 1 : 0

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

if ( gHasItachiPower[attacker] && weapon == CSW_AK47 && is_user_alive(id) ) {
// do extra damage
new extraDamage = floatround(damage * get_cvar_float("itachi_xm1014mult") - damage)
if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "xm1014", headshot )
}
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public itachi_kd()
{
if ( !hasRoundStarted() ) return

// First Argument is an id with Master Blaster Powers!
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)

if ( !is_user_alive(id) || !gHasItachiPower[id] ) return

if ( gPlayerUltimateUsed[id] ) {
playSoundDenySelect(id)
return
}

// Remember this weapon...
new clip,ammo,weaponID = get_user_weapon(id,clip,ammo)
gLastWeapon[id] = weaponID

// switch to knife
engclient_cmd(id,"weapon_knife")

new ItachiCooldown = get_cvar_num("itachi_cooldown")

fire_wave(id)

if ( ItachiCooldown > 0 ) ultimateTimer(id, ItachiCooldown * 1.0 )
}
//----------------------------------------------------------------------------------------------
public itachi_ku()
{
if ( !hasRoundStarted() ) return

// First Argument is an id with Master Blaster Powers!
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)

if ( !is_user_alive(id) ) return

// Switch back to previous weapon...
if ( gLastWeapon[id] != CSW_KNIFE ) shSwitchWeaponID( id, gLastWeapon[id] )
}
//----------------------------------------------------------------------------------------------
public fire_wave(id)
{
new aimvec[3]
new FFOn= get_cvar_num("mp_friendlyfire")

new Float:dRatio, damage, distanceBetween
new damradius = get_cvar_num("itachi_radius")
new maxdamage = get_cvar_num("itachi_maxdamage")

if( !is_user_alive(id) ) return

// Make sure still on knife
new clip,ammo,weaponID = get_user_weapon(id,clip,ammo)
if ( weaponID != CSW_KNIFE ) engclient_cmd(id,"weapon_knife")

get_user_origin(id, aimvec, 3)
waveEffects(id, aimvec, damradius)

for(new vic = 1; vic <= SH_MAXSLOTS; vic++)
{
if( is_user_alive(vic) && ( FFOn || get_user_team(id) != get_user_team(vic) ) ) {
new origin[3]
get_user_origin(vic, origin)
distanceBetween = get_distance(aimvec, origin)
if( distanceBetween < damradius ) {
dRatio = float(distanceBetween) / float(damradius)
damage = maxdamage - floatround( maxdamage * dRatio)
shExtraDamage(vic, id, damage, "Kamehameha")

//testing raidus to see how much damage is caused
//client_print(id,print_chat,"damage: %d", damage)
} // distance
} // alive
} // loop
}
//----------------------------------------------------------------------------------------------
public waveEffects(id, aimvec[3], damradius)
{
new origin[3], decal_id
get_user_origin(id, origin)

//Change sprite size according to blast radius
new blastSize = floatround( damradius / 3.0 )

//Change burn decal size according to blast size
if (blastSize <= 60) {
decal_id = burn_decal[random_num(0,2)]
}
else {
decal_id = burn_decal_big[random_num(0,2)]
}

//BEAMENTPOINTS
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte(1) //TE_BEAMENTPOINTS
write_short(id)
write_coord(aimvec[0])
write_coord(aimvec[1])
write_coord(aimvec[2])
write_short(Beam) // model
write_byte(1) // start frame
write_byte(35) // framerate
write_byte(5) // life
write_byte(420) // width
write_byte(0) // noise
write_byte(30) // red (rgb color)
write_byte(144) // green (rgb color)
write_byte(255) // blue (rgb color)
write_byte(255) // brightness
write_byte(200) // speed
message_end()

//EXPLOSION
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte(3) //TE_EXPLOSION
write_coord(aimvec[0]) //pos
write_coord(aimvec[1])
write_coord(aimvec[2])
write_short(Fire)
write_byte(blastSize) // scale in 0.1's
write_byte(35) // framerate
write_byte(Cool // flags 10
message_end()

//BURN DECALS
if(get_cvar_num("itachi_blast_decals") == 1) {
//TE_GUNSHOTDECAL
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 109 ) // decal and ricochet sound
write_coord( aimvec[0] ) //pos
write_coord( aimvec[1] )
write_coord( aimvec[2] )
write_short (0) // I have no idea what thats supposed to be
write_byte (decal_id) //decal
message_end()
}
}
//-----------------------------------
public itachi_admincheck(id)
{
new acceslevel[10] = ADMIN_LEVEL_B

if (gItachiSelected[id] && !(get_user_flags(id) & read_flags(acceslevel)))
{
client_print(id, print_chat, "[SH](%s) ***Admin only*** You do not have admin rights and therefor do not have the right to use this hero.", gHeroName)
gHasItachiPower[id] = false
client_cmd(id, "say drop %s", gHeroName)
}
}
Back to top Go down
 
Hero: Itachi
Back to top 
Page 1 of 1
 Similar topics
-
» Hero: S.W.A.T
» Hero request
» Hero: Healthy Jelle
» Hero: Arctic predator
» Hero: Speedy Jelle

Permissions in this forum:You cannot reply to topics in this forum
Jelles SH  :: Superheroes :: New heroes made by you-
Jump to: