Raised This Month: $ Target: $400
 0% 

ADV. script, need some help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-23-2004 , 14:37   ADV. script, need some help
Reply With Quote #1

Im making a Rocket Launcher script, and everything is going fine like the speed of the rocket and such, except one thing, the rocket doesnt fire straight. I got help from PM with his mathamatics, but we cant seen to get it to go straight. Heres the code:

Code:
//////////////////// #include <amxmodx> #include <engine> #include <fun> //////////////////// #define SPEED 10.0 //////////////////// new Float:PlayerOrigin[3] new Float:flEyeOrigin[3] new Float:flVelocity[3] new EyeOrigin[3] new OwnerID[33] new RpgID[33] new smoke //////////////////// public plugin_init(){     register_plugin("RPG Rocket","0.1","knekter")     register_concmd("rocket","rocket_init") } public plugin_precache(){     precache_model("models/rpgrocket.mdl")     smoke = precache_model("sprites/smoke.spr")     return PLUGIN_CONTINUE } public rocket_init(id){         // creates the entity     RpgID[id] = create_entity("info_target")     if(RpgID[id] == 0) return PLUGIN_HANDLED         // gives the entity some traits and values     entity_set_string(RpgID[id],EV_SZ_classname,"RPG Rocket")     entity_set_model(RpgID[id],"models/rpgrocket.mdl")     entity_get_vector(id,EV_VEC_origin,PlayerOrigin)     entity_set_origin(RpgID[id],PlayerOrigin)     entity_set_int(RpgID[id],EV_INT_solid,1)     entity_set_int(RpgID[id],EV_INT_movetype,6)         // sets the rockets owner     OwnerID[id] = entity_set_edict(RpgID[id],EV_ENT_owner,id)     get_user_origin(id,EyeOrigin,3)     flEyeOrigin[0] = float(EyeOrigin[0])     flEyeOrigin[1] = float(EyeOrigin[1])     flEyeOrigin[2] = float(EyeOrigin[2])     // creates the velocity and aiming for the rocket     flVelocity[0] = flEyeOrigin[0] - PlayerOrigin[0]     flVelocity[1] = flEyeOrigin[1] - PlayerOrigin[1]     flVelocity[2] = flEyeOrigin[2] - PlayerOrigin[2]     new Float:invLen = floatsqroot(flVelocity[0]*flVelocity[0] + flVelocity[1]*flVelocity[1] +      flVelocity[2]*flVelocity[2])     flVelocity[0]*=invLen*SPEED     flVelocity[1]*=invLen*SPEED     flVelocity[2]*=invLen*SPEED     message_begin(MSG_BROADCAST,SVC_TEMPENTITY)     write_byte(22) // TE_BEAMFOLLOW     write_short(RpgID[id]) // the entity to follow     write_short(smoke) // the sprite     write_byte(2) // life     write_byte(10) // width     write_byte(255) // red     write_byte(0) // green     write_byte(0) // blue     write_byte(255) // brightness     message_end()     entity_set_vector(RpgID[id],EV_VEC_velocity,flVelocity)     return PLUGIN_CONTINUE }

Plz help!
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
 


Thread Tools
Display Modes

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 14:57.


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