AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   lighting tracers (https://forums.alliedmods.net/showthread.php?t=41033)

Mini_Midget 07-08-2006 00:19

lighting tracers
 
i'm trying to make the awp (maybe more weapons all together) to have lighting tracers
i've so far gotten this far but i'm stuck...
Code:
#include <amxmodx>   #include <amxmisc>   #include <cstrike>   new lastammo[33] new lastweapon[33] public plugin_init()     {     register_plugin("AWP Tracers","0.1","Mini_Midget")     register_event("CurWeapon","make_tracer","be","1=1","3>0")     } tracer(vec1[3],vec2[3]) {     message_begin(MSG_PAS, SVC_TEMPENTITY,vec1 );     write_byte( 6 )     write_coord(vec1[0])     write_coord(vec1[1])     write_coord(vec1[2])     write_coord(vec2[0])     write_coord(vec2[1])     write_coord(vec2[2])     message_end() } public make_tracer(id)     {     new ammo = read_data(3), weapon = read_data(2)     if(lastammo[id]>ammo && ammo>=0 && lastweapon[id]==weapon) {                 new vec1[3], vec2[3]         get_user_origin(id,vec1,1)         get_user_origin(id,vec2,4)                 if(weapon==CSW_AWP){             tracer(vec1,vec2)             lastammo[id]=ammo             } else {             lastweapon[id]=weapon             lastammo[id]=ammo         }         } else {         lastweapon[id]=weapon         lastammo[id]=ammo     }     return PLUGIN_HANDLED }
do i have to precach the lighting sprite and then do some other stuff to it to get it to work?

schnitzelmaker 07-08-2006 04:31

Re: lighting tracers
 
i think Te_tracer are invisible.test it with :
Code:

#define  TE_LIGHTNING      7      // TE_BEAMPOINTS with simplified parameters
// coord, coord, coord (start)
// coord, coord, coord (end)
// byte (life in 0.1's)
// byte (width in 0.1's)
// byte (amplitude in 0.01's)
// short (sprite model index)

Edit:not invisible,to small to see.look at this thread:http://forums.alliedmods.net/showthread.php?p=17511
And tracer cant get colored

Mini_Midget 07-08-2006 06:38

Re: lighting tracers
 
aye???
dont understand you
can you be a bit more descriptive
btw, i'm sure you can chage the colour of tracers, they just precach the model and do some other shit to it

schnitzelmaker 07-08-2006 10:23

Re: lighting tracers
 
have found a better way:
Code:
new vec1[3],Float:velocity[3],speed = 600 get_user_origin(id,vec1,1)     velocity_by_aim(id,speed,velocity) #define TE_USERTRACER            127 // larger message than the standard tracer, but allows some customization. // coord (origin) // coord (origin) // coord (origin) // coord (velocity) // coord (velocity) // coord (velocity) // byte ( life * 10 ) // byte ( color ) this is an index into an array of color vectors in the engine. (0 - ) // byte ( length * 10 )     message_begin(MSG_ALL,SVC_TEMPENTITY) write_byte(127) // TE_BEAMPOINTS) write_coord(vec1[0]) write_coord(vec1[1]) write_coord(vec1[2]) write_coord(floatround(velocity[0])) write_coord(floatround(velocity[1])) write_coord(floatround(velocity[2])) write_byte(10)     // Life write_byte(1)      //Color:1=red,2=green,max 12 colors write_byte(500)   //Higher value-> smaller tracers,lower = bigger tracers message_end()

But there is a problem:the trace fly through walls.

schnitzelmaker 07-08-2006 10:33

Re: lighting tracers
 
And here the complete plugin,that i have used for testing
Code:
#include <amxmodx> new g_nCurWeapon[33][2] public plugin_init() {     register_plugin("Colored Tracers","0.1","Schnitzelmaker")     register_event("CurWeapon","make_tracer","b") } public make_tracer(id){     new weaponID = read_data( 2 )     new wAmmo = read_data( 3 )     if( g_nCurWeapon[id][0] != weaponID ) // User Changed Weapons..     {         g_nCurWeapon[id][0] = weaponID         g_nCurWeapon[id][1] = wAmmo         return PLUGIN_CONTINUE     }     if( g_nCurWeapon[id][1] < wAmmo ) // User Reloaded..     {         g_nCurWeapon[id][1] = wAmmo         return PLUGIN_CONTINUE     }     if( g_nCurWeapon[id-1][1] == wAmmo ) // User did something else, but didn't shoot..         return PLUGIN_CONTINUE     g_nCurWeapon[id][1] = wAmmo     g_nCurWeapon[id][0] = weaponID     new vec1[3], Float:velocity[3],speed=100//have set the spped low to see the tracer effect     get_user_origin(id,vec1,1)         velocity_by_aim(id,speed,velocity)         #define TE_USERTRACER            127 // larger message than the standard tracer, but allows some customization.     // coord (origin)     // coord (origin)     // coord (origin)     // coord (velocity)     // coord (velocity)     // coord (velocity)     // byte ( life * 10 )     // byte ( color ) this is an index into an array of color vectors in the engine. (0 - )     // byte ( length * 10 )         message_begin(MSG_ALL,SVC_TEMPENTITY)     write_byte(127) // TE_BEAMPOINTS)     write_coord(vec1[0])     write_coord(vec1[1])     write_coord(vec1[2])     write_coord(floatround(velocity[0]))     write_coord(floatround(velocity[1]))     write_coord(floatround(velocity[2]))     write_byte(10)              // Life     write_byte(1)       //Color:1=red,2=green     write_byte(1000)     message_end()     return PLUGIN_CONTINUE }

Rolnaaba 07-09-2006 00:55

Re: lighting tracers
 
schnitzelmaker used [small] taggs not [code] tags easier to read plz, and ty

Shurik3n 07-09-2006 07:27

Re: lighting tracers
 
Code:
#define TE_BEAMPOINTS 0     // beam effect between two points new origin[3],originhit[3] get_user_origin(id,origin) get_user_origin(id,origin,3) //Mode 3 gets where the bullet will hit. message_begin(MSG_ ,SVC_TEMPENTITY) write_byte(TE_BEAMPOINTS) write_coord(origin[0])  // start position write_coord(origin[1]) write_coord(origin[2]) write_coord(originhit[0])   // end position write_coord(originhit[1]) write_coord(originhit[2]) //You can fill in the rest write_short()   // sprite index write_byte()    // starting frame write_byte()    // frame rate in 0.1's write_byte()    // life in 0.1's write_byte()    // line width in 0.1's write_byte()    // noise amplitude in 0.01's write_byte()    // Red write_byte()    // Green write_byte()    // Blue write_byte()    // brightness write_byte()    // scroll speed in 0.1's message_end()


All times are GMT -4. The time now is 08:01.

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