Raised This Month: $ Target: $400
 0% 

help my human torch won't fly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AZNDARKEVILDEMON
Senior Member
Join Date: Jun 2005
Location: USA
Old 09-03-2005 , 22:09   help my human torch won't fly
Reply With Quote #1

Code:
/* CVARS - copy and paste to shconfig.cfg //Human Torch  (Flying ability) torch_level 10 torch_timer 0.1         //How often (seconds) to run the loop torch_maxspeed 900      //Max Speed torch_fuel 1            //Uses health as fuel torch_cost 4            //How much health does it cost per firing torch_health 100            //How much health does ironman start with? */ #include <amxmod> #include <Vexd_Utilities> #include <amxmodx> #include <fun> #include <cstrike> #include <engine> #include <superheromod> // GLOBAL VARIABLES new gHeroName[]="Human Torch" new bool:g_hastorchPower[SH_MAXSLOTS+1] new g_jetPackRunning[SH_MAXSLOTS+1] new g_endLocation[SH_MAXSLOTS+1][3] new g_spriteFire new fire[32] // BECAUSE THIS LOOP IS CALLED SO MUCH - INSTEAD OF READING CVARS OVER AND OVER // I'LL KEEP IN GLOBAL - FOR ANTI-LAG HOPEFULLY new Float:gMaxSpeed, gUseFuel, gFuelCost, gtorchHealth new g_szRocketModel[1][] = { "sprites/fire.spr" } new g_Sound[]="ambience/flameburst1.wav" //---------------------------------------------------------------------------------------------- public plugin_init() {     // Plugin Info     register_plugin("SUPERHERO Human Torch","1.1","AZNDARKEViLDEMON")     // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG     register_cvar("torch_level", "0" )     register_cvar("torch_timer", "0.1" )     register_cvar("torch_maxspeed", "900" )     register_cvar("torch_fuel", "1" )     register_cvar("torch_cost","2")     register_cvar("torch_health","100")     // FIRE THE EVENT TO CREATE THIS SUPERHERO!     shCreateHero(gHeroName, "Human Torch", "Human Torch - Fly with fire as seen in the movie.", true, "torch_level" )     // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)     register_event("ResetHUD","newRound","b")     // KEY UP     register_srvcmd("torch_ku",   "torch_ku")     shRegKeyUp(gHeroName, "torch_ku")     // KEY DOWN     register_srvcmd("torch_kd", "torch_kd")     shRegKeyDown(gHeroName, "torch_kd")     // DEATH     register_event("DeathMsg", "torch_death", "a")     // INIT     register_srvcmd("torch_init", "torch_init")     shRegHeroInit(gHeroName, "torch_init")     //Waits 4 seconds then loads cvars into variables     set_task(4.0,"loadCVARS")         //Let MOD know about his max health     shSetMaxHealth(gHeroName, "torch_health" ) } //---------------------------------------------------------------------------------------------- public plugin_precache() {     g_spriteFire = precache_model("sprites/laserbeam.spr")     precache_sound(g_Sound)     for( new i = 0; i < 1; i++ )         precache_model( g_szRocketModel[i] ) } //---------------------------------------------------------------------------------------------- public loadCVARS() {     gMaxSpeed = get_cvar_float("torch_maxspeed")     gUseFuel = get_cvar_num("torch_fuel")     gFuelCost = get_cvar_num("torch_cost")     gtorchHealth = get_cvar_num("torch_health") } //---------------------------------------------------------------------------------------------- public jetPackFireEffect(origin[3]) {         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)     write_byte(11)     write_coord(origin[0])     write_coord(origin[1])     write_coord(origin[2]-34)     message_end() } //---------------------------------------------------------------------------------------------- public torch_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 fire man powers     read_argv(2,temp,5)     new hasPowers=str_to_num(temp)     g_hastorchPower[id] = (hasPowers!=0)     if ( g_hastorchPower[id] ) {         remove_task(id+36485)         set_task( get_cvar_float("torch_timer"), "torch_loop", id+36485, "", 0, "b")     }     else {         shRemHealthPower(id)         remove_task(id+36485)     } } //---------------------------------------------------------------------------------------------- public torch_loop(id) {     id -= 36485     new Float:velocity[3]     new origin[3], userHealth     new user_origin[3]     new aimvec[3]     new Float:b_orig[3]     if ( !is_user_alive(id) ) return PLUGIN_HANDLED     // Increase Health for this guy     userHealth = get_user_health(id)     if ( userHealth < gtorchHealth && g_jetPackRunning[id] == 0 ) {         set_user_health(id, userHealth + 1 )         return PLUGIN_HANDLED     }     // OK - We'll make this health based - but also add health     // So you can run out of fuel, but get it back too     if ( gUseFuel != 0 && gFuelCost > userHealth && g_jetPackRunning[id] == 1 ) {         playSoundDenySelect(id)         g_jetPackRunning[id] = 0         set_user_info(id,"JETPACK_RUN","0")         client_print(id, print_center, "You ran out of fire.")         removeMark(id)         return PLUGIN_HANDLED     }     get_user_origin(id, g_endLocation[id],3)     if (g_jetPackRunning[id] == 1) {         // Decrement Fuel         if ( gUseFuel != 0 ) {             set_user_health(id, userHealth - gFuelCost )             emit_sound(id,CHAN_STATIC, g_Sound, 0.1, ATTN_NORM, 0, PITCH_LOW)         }         get_user_origin(id, user_origin)         Entvars_Get_Vector(id, EV_VEC_velocity, velocity)         new distance         distance = get_distance( g_endLocation[id], user_origin )         velocity[0] = (g_endLocation[id][0] - user_origin[0]) * ( 1.0 * gMaxSpeed / distance)         velocity[1] = (g_endLocation[id][1] - user_origin[1]) * ( 1.0 * gMaxSpeed / distance)         velocity[2] = (g_endLocation[id][2] - user_origin[2]) * ( 1.0 * gMaxSpeed / distance)         Entvars_Set_Vector(id, EV_VEC_velocity, velocity)         new distance2[2]         distance2[0] = g_endLocation[id][0]-user_origin[0]         distance2[1] = g_endLocation[id][1]-user_origin[1]             new unitsinfront = 1         aimvec[0]=user_origin[0]+(unitsinfront*distance2[0])/sqrt(distance2[0]*distance2[0]+distance2[1]*distance2[1])         aimvec[1]=user_origin[1]+(unitsinfront*distance2[1])/sqrt(distance2[0]*distance2[0]+distance2[1]*distance2[1])         aimvec[2]=user_origin[2]-34                 b_orig[0] = float(aimvec[0]);         b_orig[1] = float(aimvec[1]);         b_orig[2] = float(aimvec[2]);                 ENT_SetOrigin(fire[id], b_orig)         get_user_origin(id, origin, 1)         jetPackFireEffect(origin)     }     return PLUGIN_CONTINUE } //---------------------------------------------------------------------------------------------- // RESPOND TO KEYDOWN public torch_kd() {     // First Argument is an id with Human Torch Powers!     new temp[6]     read_argv(1,temp,5)     new id=str_to_num(temp)     if ( !hasRoundStarted() || !is_user_alive(id))     {         playSoundDenySelect(id)         g_jetPackRunning[id] = 0         set_user_info(id,"JETPACK_RUN","0")         return PLUGIN_HANDLED     }     g_jetPackRunning[id] = 1     set_user_info(id,"JETPACK_RUN","1")     //Reload CVARS to make sure the variables are current     loadCVARS()     do_this(id)     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- public torch_death() {     new id = read_data(2)     if ( id < 0 || id > SH_MAXSLOTS ) return     g_jetPackRunning[id] = 0     set_user_info(id,"JETPACK_RUN","0")     removeMark(id)     } //---------------------------------------------------------------------------------------------- // RESPOND TO KEYUP public torch_ku() {     // First Argument is an id with Human Torch Powers!     new temp[6]     read_argv(1,temp,5)     new id = str_to_num(temp)         if (g_jetPackRunning[id] != 1) return     g_jetPackRunning[id] = 0     set_user_info(id,"JETPACK_RUN","0")         removeMark(id) } //---------------------------------------------------------------------------------------------- public client_disconnect(id) {     // stupid check but lets see     if ( id <=0 || id > SH_MAXSLOTS ) return     g_jetPackRunning[id] = 0     set_user_info(id,"JETPACK_RUN","0")     // Yeah don't want any left over residuals     removeMark(id)     remove_task(id+36485) } //---------------------------------------------------------------------------------------------- public client_connect(id) {     // stupid check but lets see     if ( id <=0 || id > SH_MAXSLOTS ) return     g_jetPackRunning[id] = 0     set_user_info(id,"JETPACK_RUN","0")     // Yeah don't want any left over residuals     removeMark(id)     remove_task(id+36485) } //---------------------------------------------------------------------------------------------- public removeMark(id) {     if( fire[id] ) {                 message_begin(MSG_BROADCAST, SVC_TEMPENTITY, {0,0,0}, fire[id])         write_byte(99)         write_short(fire[id])         message_end()                 remove_entity(fire[id])         fire[id] = 0                 set_user_rendering(id)    }     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- public make_trail(id,origin2[3]) {     //Spawning fire below player         new Float: Origin[3]     new Float: vAngle[3]     new Float: Velocity[3]         remove_entity(fire[id])     Entvars_Get_Vector(id, EV_VEC_origin , Origin)     Entvars_Get_Vector(id, EV_VEC_v_angle, vAngle)           fire[id] = create_entity("info_target")         entity_set_string(fire[id], EV_SZ_classname, "fire_sheet")     ENT_SetModel(fire[id], g_szRocketModel[0])     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     Entvars_Set_Vector(fire[id], EV_VEC_mins, MinBox)     Entvars_Set_Vector(fire[id], EV_VEC_maxs, MaxBox)         ENT_SetOrigin(fire[id], Origin)     Entvars_Set_Vector(fire[id], EV_VEC_angles, vAngle)     entity_set_int(fire[id], EV_INT_solid, 0)     entity_set_int(fire[id], EV_INT_movetype, 5)     Entvars_Set_Edict(fire[id], EV_ENT_owner, id)         VelocityByAim(id, 0 , Velocity)     Entvars_Set_Vector(fire[id], EV_VEC_velocity ,Velocity)         if ( !is_user_alive(id) ) return PLUGIN_HANDLED     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)     write_byte(22)     write_short(fire[id])     write_short(g_spriteFire)     write_byte(35)     write_byte(25)     write_byte(100)     write_byte(100)     write_byte(250)     write_byte(3000)     message_end()     set_user_rendering(id,kRenderFxGlowShell,255,255,0, kRenderNormal, 16)         return PLUGIN_CONTINUE } //----------------------------------------------------------------------------------------------- public do_this(id) {     new user_origin[3]     new origin2[3]         get_user_origin(id, origin2, 1)     make_trail(id,origin2)     get_user_origin(id, user_origin)     get_user_origin(id, g_endLocation[id], 3) } //---------------------------------------------------------------------------------------------- public newRound(id) {   if (!g_hastorchPower[id]) return PLUGIN_CONTINUE   if (fire[id])   {         remove_entity(fire[id])         fire[id] = 0         g_jetPackRunning[id] = 0         set_user_info(id,"JETPACK_RUN","0")         set_user_rendering(id)   }   return PLUGIN_CONTINUE } //----------------------------------------------------------------------------------------------

it suppose to fly and use health as energy
AZNDARKEVILDEMON is offline
Send a message via AIM to AZNDARKEVILDEMON Send a message via Yahoo to AZNDARKEVILDEMON
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 22:35.


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