Raised This Month: $ Target: $400
 0% 

Grenade Trails


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
potatis_invalido
BANNED
Join Date: Jul 2007
Location: 0 (world)
Old 07-21-2007 , 00:48   Re: Grenade Trails
Reply With Quote #7

Code:
#include <amxmodx>
#include <fakemeta>
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Jim/Drak"
 
new g_cvar_tr
new g_cvar_color
new g_trail
 
new const gModel[] = "models/rpgrocket.mdl" // CHANGE THIS
 
public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_forward(FM_SetModel,"forwardSetModel");
 
    g_cvar_tr = register_cvar("amx_grenade_trails", "2")
    g_cvar_color = register_cvar("amx_grenade_color", "255000000")
 
}
 
public plugin_precache()
{
    g_trail = precache_model("sprites/smoke.spr")
}
 
public forwardSetModel(ent,const model[])
{
    if(get_pcvar_num(g_cvar_tr) && qual(model,gModel)) 
    {
        new gtm = get_pcvar_num(g_cvar_tr)
        if(!gtm) return
        new r, g, b
        switch(gtm)
        {
            case 1:
            {
                r = random(256)
                g = random(256)
                b = random(256)
            }
            case 2:
            {
                new nade, color[10]
                get_pcvar_string(g_cvar_color, color, 9)
                new c = str_to_num(color)
                r = c / 1000000
                c %= 1000000 
                g = c / 1000
                b = c % 1000    
            }
        }
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_BEAMFOLLOW)
        write_short(ent)
        write_short(g_trail)
        write_byte(10)
        write_byte(5)
        write_byte(r)
        write_byte(g)
        write_byte(b)
        write_byte(192)
        message_end()
    }
}
Less CPU usage.


EDIT: Fixed indents.

Last edited by potatis_invalido; 08-21-2007 at 17:48.
potatis_invalido is offline
 



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 21:30.


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