Raised This Month: $ Target: $400
 0% 

R/C Apache hero needs a little help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
collateral
Junior Member
Join Date: Apr 2006
Old 05-15-2006 , 17:11   R/C Apache hero needs a little help
Reply With Quote #1

Hey this is a great hero that a lot of people put time and effort into... i have the plugin but omega and a little bit from me turned it into a hero...its just got some loose indentation that needs tightening....can somebody give us a hand?
Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fun> 
#include <fakemeta> 
#include <engine> 
#include <superheromod>

#define DAMAGE_AIM 2.0 

new apaches[33], camera[33], apache_speed[33], grabbed[33] 
new smoke, boom, laserbeam 
new maxplayers 
new bool:wait_rocket[33], bool:wait_bomb[33], bool:wait_stealth[33], stealth[33] 
new gmsgNVGToggle 
new oldff 


// VARIABLES
new gHeroName[]="Apache"
new bool:g_hasApachePower[SH_MAXSLOTS+1]

public plugin_init() 
{ 
   register_plugin("SUPERHERO Apache", "0.1.5", "KRoTaL, Fox-NL") 

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Summon an Apache Helicopter", "Summon an apache helicoper with it you can kill your enemies", true, "Apache_level")

   register_clcmd("nightvision", "stealth_mode") 

   register_cvar("apache_level", "19" )
   register_cvar("apache_cooldown", "90" )
   register_cvar("apache_health", "1000") 
   register_cvar("apache_maxspeed", "400") 
   register_cvar("apache_stealth_amount", "40") 
   register_cvar("apache_stealth_maxspeed", "60") 
   register_cvar("apache_stealth_regen", "10") 
   register_cvar("apache_bulletdmg", "10") 
   register_cvar("apache_bulletspeed", "2000") 
   register_cvar("apache_rocketspeed", "1000") 
   register_cvar("apache_dist", "70") 
   register_cvar("apache_height", "20") 
   register_cvar("apache_beams", "0") 
   register_cvar("apache_cost", "5000") 
   register_cvar("apache_admins", "0") 
   register_cvar("apache_ff", "0") 
   
   	// KEY DOWN
	register_srvcmd("Apache_kd", "Apache_kd")
	shRegKeyDown(gHeroName, "Apache_kd")

   register_event("DeathMsg", "death_event", "a") 
   register_event("ResetHUD", "resethud_event", "be") 
   register_event("CurWeapon", "check_weapon", "be", "1=1") 
   register_logevent("new_round", 2, "0=World triggered", "1=Round_Start") 
//   register_event("TextMsg", "game_restart", "a", "1=4", "2&#Game_C", "2&#Game_w") 
//   register_event("SendAudio", "round_end", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw") 

   maxplayers = get_maxplayers() 

   gmsgNVGToggle = get_user_msgid("NVGToggle") 
} 

public plugin_precache() 
{ 
   laserbeam = precache_model("sprites/laserbeam.spr") 
   smoke = precache_model("sprites/smoke.spr") 
   boom = precache_model("sprites/zerogxplode.spr") 

   precache_model("models/rc_apache_final.mdl") 
   precache_model("models/rpgrocket.mdl") 
   precache_model("models/shell.mdl") 

   precache_sound("vox/_period.wav") 
   precache_sound("weapons/rocketfire1.wav") 
   precache_sound("weapons/rocket1.wav") 
   precache_sound("weapons/m249-1.wav") 
   precache_sound("apache/ap_rotor2.wav") 
} 

public Apache_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 wolverine skills
	read_argv(2,temp,5)
	new hasPowers=str_to_num(temp)

	g_hasApachePower[id]=(hasPowers!=0)
}


public Apache_kd()
{
	new temp[6]
	read_argv(1,temp,5)
	new id = str_to_num(temp)

	if(!is_user_alive(id))
		return PLUGIN_HANDLED

	if(apaches[id] > 0 || gPlayerUltimateUsed[id]) {
		playSoundDenySelect(id)
		return PLUGIN_HANDLED
	}
	
	gPlayerUltimateUsed[id] = true
	ultimateTimer(id, float(get_cvar_num("Apache_cooldown")))

	create_apache(id)
	
	return PLUGIN_HANDLED
}


stock fake_dmg(victim, szClassname[], Float:damage, damagetype) 
{ 
   new entity = create_entity("trigger_hurt") 
   if(entity) 
   { 
      DispatchKeyValue(entity, "classname", "trigger_hurt") 
      new szDamage[16] 
      format(szDamage, 15, "%f", damage * 2) 
      DispatchKeyValue(entity, "dmg", szDamage) 
      format(szDamage,15, "%i", damagetype) 
      DispatchKeyValue(entity, "damagetype", szDamage) 
      DispatchKeyValue(entity, "origin", "8192 8192 8192") 
      DispatchSpawn(entity) 
      entity_set_string(entity, EV_SZ_classname, szClassname) 
      fake_touch(entity, victim) 
      remove_entity(entity) 
      return 1 
   } 
   return 0 
} 

public client_connect(id) 
{ 
   if(task_exists(54545454+id)) 
   { 
      remove_task(54545454+id) 
   } 
   apaches[id] = 0 
   camera[id] = 0 
   grabbed[id] = 0 
   wait_rocket[id] = false 
   wait_bomb[id] = false 
   wait_stealth[id] = false 
   stealth[id] = false 
} 

public client_disconnect(id) 
{ 
   if(task_exists(54545454+id)) 
   { 
      remove_task(54545454+id) 
   } 
   if(apaches[id] > 0) 
   { 
      emit_sound(apaches[id], CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
      remove_entity(apaches[id]) 
      apaches[id] = 0 
   } 
   if(camera[id] > 0) 
   {    
      remove_entity(camera[id]) 
      camera[id] = 0 
   } 
   grabbed[id] = 0 
   wait_rocket[id] = false 
   wait_bomb[id] = false 
   wait_stealth[id] = false 
   stealth[id] = false 
} 

public new_round() 
{ 
   if (find_ent_by_class(-1, "apache_bullet")) 
   { 
      remove_entity(find_ent_by_class(-1, "apache_bullet")) 
   } 
//   remove_entity_name("apache_bullet") 
    
   new ent = find_ent_by_class(-1, "apache_rocket") 
   while(ent > 0) 
   { 
      emit_sound(ent, CHAN_WEAPON, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
      //emit_sound(ent, CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
      remove_entity(ent) 
      ent = find_ent_by_class(ent, "apache_rocket") 
   }    
   set_task(0.1, "set_speed", 875457545) 
} 

public round_end() 
{ 
   set_task(4.0, "disable_sound", 212454212) 

   return PLUGIN_CONTINUE 
} 

public game_restart() 
{ 
   set_task(0.5, "disable_sound", 787454241) 

   return PLUGIN_CONTINUE 
} 

public disable_sound() 
{ 
   new players[32], inum 
   get_players(players, inum, "a") 
   for(new i = 0 ; i < inum ; i++) 
   { 
      if(apaches[players[i]] > 0) 
      { 
         emit_sound(apaches[players[i]], CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
      } 
   } 
} 

public death_event() 
{ 
   new id = read_data(2) 

   if(task_exists(54545454+id)) 
   { 
      remove_task(54545454+id) 
   } 
   if(apaches[id] > 0) 
   { 
      emit_sound(apaches[id], CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
      remove_entity(apaches[id]) 
      apaches[id] = 0 
   } 
   if(camera[id] > 0) 
   {    
      attach_view(id, id) 
      remove_entity(camera[id]) 
      camera[id] = 0 
   } 
   for(new i = 1 ; i < maxplayers ; i++) 
   { 
      if(grabbed[i] == id) 
      { 
         grabbed[i] = 0 
      } 
   } 
   grabbed[id] = 0 
   wait_rocket[id] = false 
   wait_bomb[id] = false 
   wait_stealth[id] = false 
   stealth[id] = false 
/* 
   message_begin(MSG_ONE, gmsgNVGToggle, {0,0,0}, id) 
   write_byte(0) 
   message_end() 
*/ 
} 

public resethud_event(id) 
{ 
   if(task_exists(54545454+id)) 
   { 
      remove_task(54545454+id) 
   } 
   if(apaches[id] > 0) 
   { 
      new Float:apachecost = get_cvar_float("apache_cost") 
      new Float:apachehealth = get_cvar_float("apache_health") 
      new Float:apachecurhealth = entity_get_float(apaches[id], EV_FL_health) - 5000 
      new payback = floatround((apachecost * apachecurhealth) / apachehealth) 
//      set_user_money(id, get_user_money(id) + payback, 1) 
      emit_sound(apaches[id], CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
      remove_entity(apaches[id]) 
      apaches[id] = 0 

   } 
   if(camera[id] > 0) 
   {    
      attach_view(id, id) 
      remove_entity(camera[id]) 
      camera[id] = 0 
   } 
   grabbed[id] = 0 
   wait_rocket[id] = false 
   wait_bomb[id] = false 
   wait_stealth[id] = false 
   stealth[id] = false 
/* 
   message_begin(MSG_ONE, gmsgNVGToggle, {0,0,0}, id) 
   write_byte(0) 
   message_end() 
*/ 
} 

public check_weapon(id) 
{ 
   if(apaches[id] > 0) 
   { 
      client_cmd(id, "weapon_knife") 
      set_user_maxspeed(id, -1.0) 
   } 
} 

public set_speed(id) 
{ 
   new players[32], inum 
   get_players(players, inum, "a") 
   for(new i = 0 ; i < inum ; i++) 
   { 
      if(apaches[players[i]] > 0) 
      { 
         set_user_maxspeed(players[i], -1.0) 
      } 
   } 
} 

public create_apache(id) 
{ 
   new Float:origin[3] 
   new Float:angles[3] 
   entity_get_vector(id, EV_VEC_origin, origin) 
   entity_get_vector(id, EV_VEC_v_angle, angles) 

   apaches[id] = create_entity("info_target") 
   if(apaches[id] > 0) 
   { 
      entity_set_string(apaches[id], EV_SZ_classname, "amx_apache") 
      entity_set_model(apaches[id], "models/rc_apache_final.mdl") 

      new Float:MinBox[3] 
      new Float:MaxBox[3] 

      MinBox[0] = -12.0 
      MinBox[1] = -12.0 
      MinBox[2] = -6.0 
      MaxBox[0] = 12.0 
      MaxBox[1] = 12.0 
      MaxBox[2] = 6.0 

      entity_set_size(apaches[id], MinBox, MaxBox) 

      entity_set_origin(apaches[id], origin) 
      entity_set_vector(apaches[id], EV_VEC_angles, angles) 

      entity_set_int(apaches[id], EV_INT_solid, 2) 
      entity_set_int(apaches[id], EV_INT_movetype, 5) 
      entity_set_edict(apaches[id], EV_ENT_owner, id) 
      entity_set_int(apaches[id], EV_INT_sequence, 1) 
      entity_set_float(apaches[id], EV_FL_takedamage, DAMAGE_AIM) 
      entity_set_float(apaches[id], EV_FL_health, get_cvar_float("apache_health") + 5000.0) 

      apache_speed[id] = 50 

      new Float:velocity[3] 
      VelocityByAim(id, apache_speed[id], velocity) 
      entity_set_vector(apaches[id], EV_VEC_velocity, velocity) 

      emit_sound(apaches[id], CHAN_VOICE, "apache/ap_rotor2.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
   } 

   camera[id] = create_entity("info_target") 
   if(camera[id] > 0) 
   { 
      entity_set_string(camera[id], EV_SZ_classname, "camera") 
      entity_set_int(camera[id], EV_INT_solid, SOLID_NOT) 
      entity_set_int(camera[id], EV_INT_movetype, MOVETYPE_NOCLIP) 
      entity_set_size(camera[id], Float:{0,0,0}, Float:{0,0,0}) 
      entity_set_model(camera[id], "models/rpgrocket.mdl") 
      set_rendering(camera[id], kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)   //basically set invisible 
       
      entity_set_origin(camera[id], origin) 
      entity_set_vector(camera[id], EV_VEC_angles, angles) 

      attach_view(id, camera[id]) 
   } 

   engclient_cmd(id, "weapon_knife") 
   set_user_maxspeed(id, -1.0) 
   
    new origin[3]
   get_user_origin(id, origin)
   origin[2] = origin[2] - 200
   set_user_origin(id, origin)  

   if(task_exists(54545454+id)) 
   { 
      remove_task(54545454+id) 
   } 

   grabbed[id] = 0 
   wait_rocket[id] = false 
   wait_bomb[id] = false 
   wait_stealth[id] = false 
   stealth[id] = false 

   return PLUGIN_HANDLED 
} 

public destroy_apache(id) 
{ 
   if(apaches[id] > 0) 
   { 
      attach_view(id, id) 
      emit_sound(apaches[id], CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
      remove_entity(apaches[id]) 
      apaches[id] = 0       
      
	  new origin[3]
	  get_user_origin(id, origin)
	  origin[2] = origin[2] - 300
	  set_user_origin(id, origin)  
   } 
   if(camera[id] > 0) 
   {    
      attach_view(id, id) 
      remove_entity(camera[id]) 
      camera[id] = 0 
   } 

   if(task_exists(54545454+id)) 
   { 
      remove_task(54545454+id) 
   } 

   grabbed[id] = 0 
   wait_rocket[id] = false 
   wait_bomb[id] = false 
   wait_stealth[id] = false 
   stealth[id] = false 

/* 
   message_begin(MSG_ONE, gmsgNVGToggle, {0,0,0}, id) 
   write_byte(0) 
   message_end() 
*/ 

   return PLUGIN_HANDLED 
} 

public stop_apache(id) 
{ 
   if(apaches[id] > 0) 
   { 
      if(apache_speed[id] <= 30 && apache_speed[id] >= -30) 
      { 
         apache_speed[id] = 0 
      } 
      return PLUGIN_HANDLED 
   } 

   return PLUGIN_CONTINUE 
} 

public stealth_mode(id) 
{ 
   if(apaches[id] > 0) 
   { 
      if(!wait_stealth[id]) 
      { 
         if(!stealth[id]) 
         { 
            stealth[id] = true 
            emit_sound(apaches[id], CHAN_VOICE, "apache/ap_rotor2.wav", 0.1, ATTN_NORM, 0, PITCH_NORM) 
            set_rendering(apaches[id], kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_cvar_num("apache_stealth_amount")) 
/* 
            message_begin(MSG_ONE, gmsgNVGToggle, {0,0,0}, id) 
            write_byte(1) 
            message_end() 
*/ 
         } 
         else        
         { 
            stealth[id] = false 
            emit_sound(apaches[id], CHAN_VOICE, "apache/ap_rotor2.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
            set_rendering(apaches[id]) 
/* 
            message_begin(MSG_ONE, gmsgNVGToggle, {0,0,0}, id) 
            write_byte(0) 
            message_end() 
*/             
            wait_stealth[id] = true 
            new ids[1] 
            ids[0] = id 
            set_task(get_cvar_float("apache_stealth_regen"), "reset_stealth", 54545454+id, ids, 1) 
         } 
      } 
      return PLUGIN_HANDLED 
   } 

   return PLUGIN_CONTINUE 
} 

public client_PreThink(id) 
{ 

   if(apaches[id] > 0 && camera[id] > 0) 
   { 
      if(entity_get_float(apaches[id], EV_FL_health) < 5000) 
      { 
         oldff = get_cvar_num("mp_friendlyfire") 
         set_cvar_num("mp_friendlyfire", 1) 

         new Float:explosion[3] 
         entity_get_vector(apaches[id], EV_VEC_origin, explosion) 

         message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
         write_byte(3) 
         write_coord(floatround(explosion[0])) 
         write_coord(floatround(explosion[1])) 
         write_coord(floatround(explosion[2])) 
         write_short(boom) 
         write_byte(50) 
         write_byte(15) 
         write_byte(0) 
         message_end() 

         //RadiusDamage(apaches[id], 50, 40, explosion, 300, DMG_BLAST) 
         RadiusDamage(explosion, 50, 300) 

         attach_view(id, id) 
         if(camera[id] > 0) 
         {    
            remove_entity(camera[id]) 
            camera[id] = 0 
         } 
         emit_sound(apaches[id], CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
         remove_entity(apaches[id]) 
         apaches[id] = 0 
         set_user_maxspeed(id, 250.0) 
         if(task_exists(54545454+id)) 
         { 
            remove_task(54545454+id) 
         } 
         wait_rocket[id] = false 
         wait_stealth[id] = false 
         stealth[id] = false 
/* 
         message_begin(MSG_ONE, gmsgNVGToggle, {0,0,0}, id) 
         write_byte(0) 
         message_end() 
*/ 

         set_cvar_num("mp_friendlyfire", oldff) 

         return PLUGIN_CONTINUE 
      } 

      if(entity_get_float(apaches[id], EV_FL_frame) < 0.0 || entity_get_float(apaches[id], EV_FL_frame) > 254) 
      { 
         entity_set_float(apaches[id], EV_FL_frame, 0.0) 
      } 
      else 
      { 
         entity_set_float(apaches[id], EV_FL_frame, entity_get_float(apaches[id], EV_FL_frame) + 1.0) 
      } 

      new Float:forigin[3], Float:dist_origin[3], Float:camera_origin[3] 
      entity_get_vector(apaches[id], EV_VEC_origin, forigin) 
      if(get_user_button(id) & IN_FORWARD) 
      { 
         apache_speed[id] += 5 
      } 
      if(get_user_button(id) & IN_BACK) 
      { 
         apache_speed[id] -= 5 
         /*if(apache_speed[id] < 0) // more realistic 
         { 
            apache_speed[id] = 0 
         }*/ 
      } 
      new maxspeed 
      if(!stealth[id]) 
      { 
         maxspeed = get_cvar_num("apache_maxspeed") 
      } 
      else 
      { 
         maxspeed = get_cvar_num("apache_stealth_maxspeed") 
      } 
      if(apache_speed[id] > maxspeed) 
      { 
         apache_speed[id] = maxspeed 
      } 
      if(apache_speed[id] < - 80) 
      { 
         apache_speed[id] = - 80 
      } 

      entity_get_vector(apaches[id], EV_VEC_origin, forigin) 
      new Float:angles[3], Float:velocity[3] 
      entity_get_vector(id, EV_VEC_angles, angles) 
      angles[0] = - angles[0] 
      VelocityByAim(id, apache_speed[id], velocity) 
      entity_set_vector(apaches[id], EV_VEC_angles, angles) 
      entity_set_vector(apaches[id], EV_VEC_velocity, velocity) 

      if(get_user_button(id) & IN_JUMP) 
      { 
         forigin[2] += 2.0 
         if(PointContents(forigin) != CONTENTS_SOLID) 
         { 
            entity_set_vector(apaches[id], EV_VEC_origin, forigin) 
         } 
      } 
      if(get_user_button(id) & IN_DUCK) 
      { 
         forigin[2] -= 2.0 
         if(PointContents(forigin) != CONTENTS_SOLID) 
         { 
            entity_set_vector(apaches[id], EV_VEC_origin, forigin) 
         } 
      } 

      if(PointContents(forigin) == CONTENTS_SOLID) 
      { 
         forigin[2] += 10.0 
         if(PointContents(forigin) == CONTENTS_SOLID) 
         { 
            forigin[2] -= 60.0 
         } 
         entity_set_vector(apaches[id], EV_VEC_origin, forigin) 
      } 

      VelocityByAim(id, get_cvar_num("apache_dist"), dist_origin) 
      camera_origin[0] = forigin[0] - dist_origin[0] 
      camera_origin[1] = forigin[1] - dist_origin[1] 
      camera_origin[2] = forigin[2] + get_cvar_float("apache_height") 
      entity_set_vector(camera[id], EV_VEC_origin, camera_origin) 
      entity_set_vector(camera[id], EV_VEC_angles, angles) 

      if(get_user_button(id) & IN_ATTACK && !(get_user_oldbutton(id) & IN_ATTACK) )//&& entity_count() < entity_count() - 50) 
      { 
         emit_sound(apaches[id], CHAN_WEAPON, "weapons/m249-1.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 

         new ent = create_entity("info_target") 
         if(ent > 0) 
         { 
            entity_set_string(ent, EV_SZ_classname, "apache_bullet") 
            entity_set_model(ent, "models/shell.mdl") 

            new Float:MinBox[3] 
            new Float:MaxBox[3] 
            MinBox[0] = -1.0 
            MinBox[1] = -1.0 
            MinBox[2] = -1.0 
            MaxBox[0] = 1.0 
            MaxBox[1] = 1.0 
            MaxBox[2] = 1.0 

            entity_set_size(ent, MinBox, MaxBox) 

            entity_set_vector(ent, EV_VEC_origin, forigin) 
            entity_set_vector(ent, EV_VEC_angles, angles) 

            entity_set_int(ent, EV_INT_solid, 1) 
            entity_set_int(ent, EV_INT_movetype, 5) 
            entity_set_edict(ent, EV_ENT_owner, id) 

            VelocityByAim(id, get_cvar_num("apache_bulletspeed"), velocity) 
            entity_set_vector(ent, EV_VEC_velocity, velocity) 

            message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
            write_byte(22) 
            write_short(ent) 
            write_short(smoke) 
            write_byte(25) 
            write_byte(1) 
            write_byte(255) 
            write_byte(255) 
            write_byte(255) 
            write_byte(128) 
            message_end() 
         } 
      } 
      if(get_user_button(id) & IN_ATTACK2 && !wait_rocket[id] ) //&& entity_count() < entity_count() - 50) 
      { 
         new ent = create_entity("info_target") 
         if(ent > 0) 
         { 
            entity_set_string(ent, EV_SZ_classname, "apache_rocket") 
            entity_set_model(ent, "models/rpgrocket.mdl") 

            new Float:MinBox[3] 
            new Float:MaxBox[3] 
            MinBox[0] = -1.0 
            MinBox[1] = -1.0 
            MinBox[2] = -1.0 
            MaxBox[0] = 1.0 
            MaxBox[1] = 1.0 
            MaxBox[2] = 1.0 

            entity_set_size(ent, MinBox, MaxBox) 

            entity_set_vector(ent, EV_VEC_origin, forigin) 
            entity_set_vector(ent, EV_VEC_angles, angles) 

            entity_set_int(ent, EV_INT_effects, 64) 
            entity_set_int(ent, EV_INT_solid, 1) 
            entity_set_int(ent, EV_INT_movetype, 5) 
            entity_set_edict(ent, EV_ENT_owner, id) 

            VelocityByAim(id, get_cvar_num("apache_rocketspeed"), velocity) 
            entity_set_vector(ent, EV_VEC_velocity, velocity) 

            message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
            write_byte(22) 
            write_short(ent) 
            write_short(smoke) 
            write_byte(40) 
            write_byte(4) 
            write_byte(255) 
            write_byte(0) 
            write_byte(0) 
            write_byte(128) 
            message_end() 

            emit_sound(ent, CHAN_WEAPON, "weapons/rocketfire1.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
            //emit_sound(ent, CHAN_VOICE, "weapons/rocket1.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
         } 
         wait_rocket[id] = true 
         set_task(2.0, "reset_rocket", id) 
      } 
      if(get_user_button(id) & IN_RELOAD && !wait_bomb[id] && grabbed[id] == 0 ) //&& entity_count() < entity_count() - 50) 
      { 
         new ent = create_entity("info_target") 
         if(ent > 0) 
         { 
            entity_set_string(ent, EV_SZ_classname, "apache_bomb") 
            entity_set_model(ent, "models/rpgrocket.mdl") 

            new Float:MinBox[3] 
            new Float:MaxBox[3] 
            MinBox[0] = -1.0 
            MinBox[1] = -1.0 
            MinBox[2] = -1.0 
            MaxBox[0] = 1.0 
            MaxBox[1] = 1.0 
            MaxBox[2] = 1.0 

            entity_set_size(ent, MinBox, MaxBox) 

            entity_set_vector(ent, EV_VEC_origin, forigin) 
            entity_set_vector(ent, EV_VEC_angles, angles) 

            entity_set_int(ent, EV_INT_solid, 1) 
            entity_set_int(ent, EV_INT_movetype, 6) 
            entity_set_edict(ent, EV_ENT_owner, id) 
         } 
         wait_bomb[id] = true 
         set_task(4.0, "reset_bomb", id) 
      } 
      if(get_user_button(id) & IN_USE && !(get_user_oldbutton(id) & IN_USE)) 
      { 
         if(grabbed[id] == 0) 
         { 
            new players[32], inum 
            get_players(players, inum, "a") 
            new ent = find_ent_in_sphere (players[0], forigin, 60.0) 
            while(ent > 0 && grabbed[id] == 0) 
            { 
               new classname[32] 
               entity_get_string(ent, EV_SZ_classname, classname, 31) 
               if(equal(classname, "player") || equal(classname, "grenade") || equal(classname, "weaponbox") || equal(classname, "armoury_entity") || equal(classname, "hostage_entity")) 
               { 
                  new Float:ent_origin[3] 
                  entity_get_vector(ent, EV_VEC_origin, ent_origin) 
                  if(ent_origin[2] < forigin[2]) 
                  { 
                     grabbed[id] = ent 
                     if(equal(classname, "hostage_entity")) 
                     { 
                        entity_set_int(apaches[id], EV_INT_solid, 3) 
                     } 
                  } 
               } 
               ent = find_ent_in_sphere(ent, forigin, 60.0) 
            } 
         } 
         else 
         { 
            new classname[32] 
            entity_get_string(grabbed[id], EV_SZ_classname, classname, 31) 
            if(!equal(classname, "player")) 
            { 
               entity_set_vector(grabbed[id], EV_VEC_velocity, Float:{0,0,-20}) 
            } 
            grabbed[id] = 0 
            entity_set_int(apaches[id], EV_INT_solid, 2) 
         } 
      } 
      if(get_user_button(id) & IN_MOVELEFT) 
      { 
         client_cmd(id, "+left") 
      } 
      else if(get_user_oldbutton(id) & IN_MOVELEFT) 
      { 
         client_cmd(id, "-left") 
      } 
      if(get_user_button(id) & IN_MOVERIGHT) 
      { 
         client_cmd(id, "+right") 
      } 
      else if(get_user_oldbutton(id) & IN_MOVERIGHT) 
      { 
         client_cmd(id, "-right") 
      } 
      if(get_cvar_num("apache_beams") == 1) 
      { 
         new Float:aim_origin[3], Float:end_origin[3] 
         VelocityByAim(id, 9999, velocity) 
         end_origin[0] = forigin[0] + velocity[0] 
         end_origin[1] = forigin[1] + velocity[1] 
         end_origin[2] = forigin[2] + velocity[2] 
         new ent 
         trace_line(ent, forigin, end_origin, aim_origin) 
         message_begin(MSG_ONE, SVC_TEMPENTITY, {0,0,0}, id) 
         write_byte(1) 
         write_short(apaches[id]) 
         write_coord(floatround(aim_origin[0])) 
         write_coord(floatround(aim_origin[1])) 
         write_coord(floatround(aim_origin[2])) 
         write_short(laserbeam) 
         write_byte(1) 
         write_byte(1) 
         write_byte(1) 
         write_byte(8) 
         write_byte(0)  
         write_byte(255) 
         write_byte(0) 
         write_byte(0) 
         write_byte(128)  
         write_byte(0) 
         message_end() 
      } 
      if(grabbed[id] > 0) 
      { 
         new Float:aim_origin[3], Float:end_origin[3] 
         VelocityByAim(id, 9999, velocity) 
         end_origin[0] = forigin[0] + velocity[0] 
         end_origin[1] = forigin[1] + velocity[1] 
         end_origin[2] = forigin[2] + velocity[2] 
         new ent 
         trace_line(ent, forigin, end_origin, aim_origin) 

         new Float:direction[3], Float:moveto[3], Float:grabbedorigin[3], Float:length 
         entity_get_vector(grabbed[id], EV_VEC_origin, grabbedorigin) 

         direction[0] = aim_origin[0] - forigin[0] 
         direction[1] = aim_origin[1] - forigin[1] 
         direction[2] = aim_origin[2] - forigin[2] 

         length = vector_distance(aim_origin,forigin) 
         if (!length) length = 1.0 

         moveto[0] = forigin[0] + direction[0] / length 
         moveto[1] = forigin[1] + direction[1] / length 
         new classname[32] 
         entity_get_string(grabbed[id], EV_SZ_classname, classname, 31) 
         if(equal(classname, "player")) 
         { 
            moveto[2] = (forigin[2] + direction[2] / length) - 45.0 
            velocity[0] = (moveto[0] - grabbedorigin[0]) * 5 
            velocity[1] = (moveto[1] - grabbedorigin[1]) * 5 
            velocity[2] = (moveto[2] - grabbedorigin[2]) * 5 
         } 
         else 
         { 
            moveto[2] = (forigin[2] + direction[2] / length) - 15.0 
            velocity[0] = (moveto[0] - grabbedorigin[0]) * 10 
            velocity[1] = (moveto[1] - grabbedorigin[1]) * 10 
            velocity[2] = (moveto[2] - grabbedorigin[2]) * 10 
         } 

         entity_set_vector(grabbed[id], EV_VEC_velocity, velocity) 
      } 
      set_hudmessage(255, 255, 255, -2.0, 0.76, 0, 1.0, 0.01, 0.1, 0.2, 4) 
      show_hudmessage(id, " [APACHE] Speed: %i, Health: %i", apache_speed[id], floatround(entity_get_float(apaches[id], EV_FL_health) - 5000)) 
   } 

   return PLUGIN_CONTINUE 
} 

public reset_rocket(id) 
{ 
   wait_rocket[id] = false 
} 

public reset_bomb(id) 
{ 
   wait_bomb[id] = false 
} 

public reset_stealth(ids[]) 
{ 
   wait_stealth[ids[0]] = false 
} 

//public entity_touch(entity1, entity2) 
public pfn_touch(ptr, ptd) 
{ 
   if(ptr > 0) 
   { 
      new classname[32] 
      entity_get_string(ptr, EV_SZ_classname, classname, 31) 
      new classname2[32] 
      if(ptd > 0) 
      { 
         if ( is_valid_ent(ptd) ) 
            entity_get_string(ptd, EV_SZ_classname, classname2, 31) 
      } 

      if((equal(classname, "apache_rocket") || equal(classname, "apache_bomb")) && (ptd == 0 || equal(classname2, "player") || equal(classname2, "amx_apache"))) 
      { 
         new attacker = entity_get_edict(ptr, EV_ENT_owner) 
         if(ptd > 0) 
         { 
            if(attacker == entity_get_edict(ptd, EV_ENT_owner)) 
            { 
               return PLUGIN_CONTINUE 
            } 
         } 

         new Float:explosion[3] 
         entity_get_vector(ptr, EV_VEC_origin, explosion) 

         oldff = get_cvar_num("mp_friendlyfire") 
         set_cvar_num("mp_friendlyfire", 1) 

         if(!stealth[attacker]) 
         { 
            //radius_damage(entity1, 200, 40, explosion, 300, DMG_BLAST) 
            RadiusDamage(explosion, 200, 300) 
         } 
         else 
         { 
            //radius_damage(entity1, 120, 40, explosion, 300, DMG_BLAST) 
            RadiusDamage(explosion, 120, 300) 
         } 

         message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
         write_byte(3) 
         write_coord(floatround(explosion[0])) 
         write_coord(floatround(explosion[1])) 
         write_coord(floatround(explosion[2])) 
         write_short(boom) 
         write_byte(50) 
         write_byte(15) 
         write_byte(0) 
         message_end() 

         emit_sound(ptr, CHAN_WEAPON, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 
         //emit_sound(entity1, CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM) 

         remove_entity(ptr) 

         set_cvar_num("mp_friendlyfire", oldff) 
      } 
      if(equal(classname, "apache_bullet")) 
      { 
         if(ptd > 0 && (equal(classname2, "player") || equal(classname2, "amx_apache"))) 
         { 
            new attacker = entity_get_edict(ptr, EV_ENT_owner) 
            if(ptd > 0) 
            { 
               if(attacker == entity_get_edict(ptd, EV_ENT_owner)) 
               { 
                  return PLUGIN_CONTINUE 
               } 
            } 
            new Float:origin[3] 
            entity_get_vector(ptd, EV_VEC_origin, origin) 
            if(ptd < maxplayers) 
            { 
               if(get_user_health(ptd) > get_cvar_num("apache_bulletdmg")) 
               { 
                  fake_dmg(ptd, "apache gun", get_cvar_float("apache_bulletdmg"), DMG_BULLET) 
               } 
               else 
               { 
                  //client_death(entity2, attacker, "apache gun") 
                  message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg"))  // Kill-Log above right 
                  write_byte(attacker)  // Attacker 
                  write_byte(ptd)  // Victim 
                  write_string("apache gun") 
                  message_end() 
               } 
            } 
            else 
            { 
               fake_dmg(ptd, "apache gun", get_cvar_float("apache_bulletdmg"), DMG_BULLET) 
            } 
         } 

         remove_entity(ptr) 
      } 
      if(equal(classname, "amx_apache")) 
      { 
         if(ptd > 0 && ptd < maxplayers) 
         { 
            new attacker = entity_get_edict(ptr, EV_ENT_owner) 
            if(get_cvar_num("apache_ff") == 1 || (get_cvar_num("apache_ff") == 0 && get_user_team(attacker) != get_user_team(ptd))) 
            { 
               if(get_user_health(ptd) > 1) 
               { 
                  fake_dmg(ptd, "apache", 1.0, DMG_SLASH) 
               } 
               else 
               { 
                  //client_death(entity2, attacker, "apache") 
                  message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg"))  // Kill-Log above right 
                  write_byte(attacker)  // Attacker 
                  write_byte(ptd)  // Victim 
                  write_string("apache") 
                  message_end() 
                   
                  client_print(ptd, print_center, "NEVER STAND IN THE ROTORS AGAIN!") 
               } 
            } 
         } 
      } 
   } 

   return PLUGIN_CONTINUE 
} 

public emitsound(entity, const sample[]) 
{ 
   if(equal(sample, "common/wpn_denyselect.wav")) 
   { 
      return PLUGIN_HANDLED 
   } 
   return PLUGIN_CONTINUE 
}
collateral is offline
Send a message via AIM to collateral Send a message via MSN to collateral
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-15-2006 , 17:42  
Reply With Quote #2

Code:
    new origin[3]
   get_user_origin(id, origin)
   origin[2] = origin[2] - 200
   set_user_origin(id, origin)
line up new origin with the others.
Code:
      attach_view(id, id)
      emit_sound(apaches[id], CHAN_VOICE, "vox/_period.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
      remove_entity(apaches[id])
      apaches[id] = 0       
     
     new origin[3]
     get_user_origin(id, origin)
     origin[2] = origin[2] - 300
     set_user_origin(id, origin)
pick a group, and line it up with the other group.

thats all the bad intentation i saw. btw, loose indentation doesnt matter really.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
collateral
Junior Member
Join Date: Apr 2006
Old 05-15-2006 , 18:38   yeah
Reply With Quote #3

The only other error messages i got were symbol is aggigned a value "gmsgNugtoggle-warning
and the other is a value of payback and origin
how do you paste the code so the numbers come up?
collateral is offline
Send a message via AIM to collateral Send a message via MSN to collateral
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-15-2006 , 19:30  
Reply With Quote #4

Code:
[small]
can you just put the exact error message, thx. helps a lot, since i dont want to bother making a sma and trying to compile, etc.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 05:36.


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