View Single Post
[ACORNS]*KENNY*
Junior Member
Join Date: Apr 2005
Old 04-04-2005 , 00:34   Xtrafun_to_Vexd
#91

Quote:
Originally Posted by {Everybody}
Freecode you are so mean

Hey ill forgive you if you update Cannonball to amx 9.9. Not much of a coder but realize it uses
Code:
#include <xtrafun>
which 9.9 does not use. (Kind of off topic)
To get that hero to work with AMX 0.9.9, do this :

1. download this: http://djeyl.net/forum/index.php?act...post&id=257674 and put it in your includes folder:
C:\Program Files\Valve\Steam\SteamApps\<your steam account>\Counter-Strike\cstrike\addons\amx\examples\include
or
C:\Program Files\Valve\Steam\SteamApps\<your steam account>\Dedicated Server\cstrike\addons\amx\examples\include
and download the new VexdUM at http://djeyl.net/forum/index.php?act...post&id=260918 to replace the one that came with 0.9.9

2. open the sma file (with notepad or wordpad) and replace the line <xtrafun> with <Xtrafun_to_Vexd> like so:

Code:
<amxmod>
<xtrafun>
<superheromod.inc>
to

Code:
<amxmod>
<Xtrafun_to_Vexd> 
<superheromod.inc>
and then save (make sure it saves as .sma and not .txt)

3. compile the sma, goto the compile folder, take the amx and place it into your plugins folder, then add to plugins.ini the plugin name, ex. sh_cannonball.amx

4. Restart your server and your good to go

(heres what it looks like

Code:
#include <amxmod>
#include <Xtrafun_to_Vexd.inc>
#include <superheromod.inc>

// CANNONBALL

// VARIABLES
new gHeroName[]="CannonBall" //Name of the Hero
new bool:ghasCannonballPower[SH_MAXSLOTS+1]
new gCanFire[SH_MAXSLOTS+1]
new gSpriteSmoke, gMaxSpeed, gThrust, gUseFuel, gFuelCost, gCanArmor, gSpriteFire, gCanTimer[SH_MAXSLOTS+1] //gSpriteBurning, 
new Float:gMultiplier
//----------------------------------------------------------------------------------------------
public plugin_init()
{
  // Plugin Info
  register_plugin("SUPERHERO CannonBall","1.0","StuD|MaN and <A<o>L>EvilGoten") //Registers Plugin
 
  // FIRE THE EVENT TO CREATE THIS SUPERHERO!
  if ( isDebugOn() ) server_print("Attempting to create CannonBall Hero")
  if (!cvar_exists("can_level")) register_cvar("can_level", "5" ) //Tells the level of hero
  shCreateHero(gHeroName, "Burst Of Super Speed", "Recharge The Boosters And Soar Fast", true, "can_level" ) //Creates hero into list

  
  // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
  // INIT
  register_srvcmd("can_init", "can_init") //Called when someone gets hero
  shRegHeroInit(gHeroName, "can_init") //Tells server u made init
  register_event("ResetHUD","newRound","b")
  register_srvcmd("can_kd", "can_kd")
  shRegKeyDown(gHeroName, "can_kd")
  register_event("DeathMsg", "can_death", "a")
  register_srvcmd("can_loop", "can_loop")
  set_task(1.0,"can_loop",0,"",0,"b" )
  
  
  // DEFAULT THE CVARS
  register_cvar("can_gravity", "0.20" )
  register_cvar("can_gravitya", "1" )
  register_cvar("can_maxspeed", "1200" )
  register_cvar("can_timer", "0.1" )
  register_cvar("can_armorcost", "100" )
  register_cvar("can_armorfuel", "5" )
  register_cvar("can_expradius", "50" )
  register_cvar("can_expdamage", "20" )
  register_cvar("can_armor", "150" )
  register_cvar("can_thrust", "900" )
  register_cvar("can_xymult", "5")
  register_cvar("can_cool", "1")
  gMultiplier=get_cvar_float("can_xymult")
  gThrust=get_cvar_num("can_thrust")
  gMaxSpeed=get_cvar_num("can_maxspeed")
  gUseFuel=get_cvar_num("can_armorfuel")
  gFuelCost=get_cvar_num("can_armorcost")
  gCanArmor=get_cvar_num("can_armor")

  shSetMaxArmor(gHeroName, "can_armor" )
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
   gSpriteSmoke   = precache_model("sprites/steam1.spr") 
   gSpriteFire    = precache_model("sprites/hexplo.spr") 
  // gSpriteBurning = precache_model("sprites/xfire.spr") 
   precache_sound("misc/missile.wav")
}
//----------------------------------------------------------------------------------------------
public can_init()
{
  new temp[6]
  // 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 cannonball powers
  read_argv(2,temp,5)
  new hasPowers=str_to_num(temp)
  
  ghasCannonballPower[id]=(hasPowers!=0)
  new parm[1]
  parm[0]=id
  if ( hasPowers!=0 )
  {
    set_task( get_cvar_float("can_timer"), "can_loop", id, parm, 1, "b")
  }
  else
  {
    remove_task(id)
  }
}
//----------------------------------------------------------------------------------------------
public canExpEffect(location[3]) 
{ 
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
   write_byte(17) 
   write_coord(location[0]) 
   write_coord(location[1]) 
   write_coord(location[2]) 
   write_short(gSpriteFire)
   write_byte(5) 
   write_byte(125) 
   message_end() 
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
   write_byte(17) 
   write_coord(location[0]) 
   write_coord(location[1]) 
   write_coord(location[2]) 
   write_short(gSpriteSmoke) 
   write_byte(5) 
   write_byte(125) 
   message_end() 
} 
//----------------------------------------------------------------------------------------------
public can_loop(parm[])
{
  new id=parm[0]
  new velocity[3] 
  new origin[3]
  new userArmor

  if ( !is_user_alive(id) ) return
  
  // Increase armor for this guy
  userArmor=get_user_armor(id)
  if ( userArmor<gCanArmor )
  {
    set_user_armor(id, userArmor + gUseFuel )
    return
  }
    
  // OK - We'll make this armor based - but also add armor
  // But get it back too
  if ( gUseFuel != 0 && gFuelCost > userArmor )
  {
     playSoundDenySelect(id)
     return
  }
 
  new canThrust=gThrust
  new canMaxSpeed=gMaxSpeed
  new Float:canXYMult=gMultiplier
  
  if (gCanFire[id] == 1) 
  {        
    // Decrement Fuel
    if ( gUseFuel!=0 )
    set_user_armor(id, userArmor - gFuelCost )
    get_user_velocity(id, velocity) 
    velocity[0] = floatround(velocity[0] * canXYMult) 
    velocity[1] = floatround(velocity[1] * canXYMult) 
    velocity[2] += canThrust
    if ( velocity[0]>canMaxSpeed  ) velocity[0]=canMaxSpeed
    if ( velocity[0]<-canMaxSpeed ) velocity[0]=-canMaxSpeed
    if ( velocity[1]>canMaxSpeed  ) velocity[1]=canMaxSpeed
    if ( velocity[1]<-canMaxSpeed ) velocity[1]=-canMaxSpeed
    if ( velocity[2]>canMaxSpeed ) velocity[2]=canMaxSpeed
    set_user_velocity(id, velocity) 

    get_user_origin(id, origin, 0)     
    canExpEffect(origin) 
    emit_sound(id, CHAN_WEAPON, "misc/missile.wav", 1.0, ATTN_NORM, 0, PITCH_LOW) 
    // Restore Gravity
    set_user_godmode(id,1)
    shSetMinGravity(gHeroName, "8000" )
    gCanTimer[id]=0
    // Turn off GODMODE
    set_user_godmode(id,0)
    get_user_origin(id, origin, 0)
    canExpEffect(origin)
    shSetMinGravity(gHeroName, "800" )
    gCanFire[id] = 0

  }
}

//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public can_kd() 
{ 
  new temp[6]
  gCanArmor=get_cvar_num("can_armorcost")
  // First Argument is an id with Cannonball Powers!
  read_argv(1,temp,5)
  new id=str_to_num(temp)
  new userArmor
  userArmor=get_user_armor(id)
  if ( userArmor<gCanArmor )
  {
    playSoundDenySelect(id)
    return PLUGIN_HANDLED 
  }  
  
  if ( !is_user_alive(id) ) return PLUGIN_HANDLED 
    
  gCanFire[id] = 1 
  shSetMinGravity(gHeroName, "can_gravity" )
  return PLUGIN_HANDLED 
} 
//----------------------------------------------------------------------------------------------
public newRound(id)
{
  // Restore Gravity
  shSetMinGravity(gHeroName, "800" )
  gCanTimer[id]=0
  // Turn off GODMODE
  set_user_godmode(id,0)
  return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public can_death()
{
  new id=read_data(2)

  if ( id<0 || id>SH_MAXSLOTS ) return PLUGIN_CONTINUE
    
  gCanFire[id]=0
  
  return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public client_disconnect(id)
{

  if ( id <=0 || id>32 ) return PLUGIN_CONTINUE
  
  remove_task(id)
  
  return PLUGIN_CONTINUE  
}
//----------------------------------------------------------------------------------------------
[ACORNS]*KENNY* is offline
Send a message via AIM to [ACORNS]*KENNY*