Raised This Month: $ Target: $400
 0% 

Grenade Trails


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SamuraiBarbi
Senior Member
Join Date: Aug 2006
Location: United States
Old 07-20-2007 , 20:24   Grenade Trails
Reply With Quote #1

Hello,
I'm trying to port this grenade trails plugin by jim yang to work with TFC, currently it only works for CS. Can anyone help with this?

PHP Code:
/*
    Grenade Trail 1.0
    Author: Jim

    Cvars:
    grenade_tr: default 2
    0 - None
    1 - Random Colors
    2 - Nade Specific
    3 - Team Specific

    grenade_he "255000000" set the trail color of Hegrenade
    grenade_fb "000000255" set the trail color of Flashbang
    grenade_sg "000255000" set the trail color of Smokegrenade
*/

#include <amxmodx>
#include <tfcx>

#define PLUGIN "Grenade Trail"
#define VERSION "1.0"
#define AUTHOR "Jim"

new g_cvar_tr
new g_cvar_he
new g_cvar_fb
new g_cvar_sg
new g_trail

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_cvar_tr register_cvar("grenade_tr""2")
    
g_cvar_he register_cvar("grenade_he""255000000")
    
g_cvar_fb register_cvar("grenade_fb""000000255")
    
g_cvar_sg register_cvar("grenade_sg""000255000")
}

public 
plugin_precache()
{
    
g_trail precache_model("sprites/smoke.spr")
}

public 
grenade_throw(idgidwid)
{
    new 
gtm get_pcvar_num(g_cvar_tr)
    if(!
gtm) return
    new 
rgb
    
switch(gtm)
    {
        case 
1:
        {
            
random(256)
            
random(256)
            
random(256)
        }
        case 
2:
        {
            new 
nadecolor[10]
            switch(
wid)
            {
                case 
CSW_HEGRENADE:    nade g_cvar_he
                
case CSW_FLASHBANG:    nade g_cvar_fb
                
case CSW_SMOKEGRENADE:    nade g_cvar_sg
            
}
            
get_pcvar_string(nadecolor9)
            new 
str_to_num(color)
            
1000000
            c 
%= 1000000 
            g 
1000
            b 
1000
        
}
        case 
3:
        {
            switch(
get_user_team(id))
            {
                case 
1255
                
case 2255
            
}
        }
    }
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW)
    
write_short(gid)
    
write_short(g_trail)
    
write_byte(10)
    
write_byte(5)
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(192)
    
message_end()

I tried replacing CSW_HEGRENADE with TFC_WPN_NORMALGRENADE but I got a compile error which said 'error 017: undefined symbol "TFC_WPN_NORMALGRENADE"'. Any info you guys can give me so I can get this plugin working would be greatly appreciated.

Last edited by SamuraiBarbi; 07-20-2007 at 20:30.
SamuraiBarbi is offline
Send a message via AIM to SamuraiBarbi Send a message via MSN to SamuraiBarbi Send a message via Yahoo to SamuraiBarbi
potatis_invalido
BANNED
Join Date: Jul 2007
Location: 0 (world)
Old 07-20-2007 , 20:56   Re: Grenade Trails
Reply With Quote #2

PHP Code:
/*
    Grenade Trail 1.0
    Author: Jim
    Ported by: SamuraiBarbi & potatis_invalido
 
    Cvars:
    amx_grenade_trails: default 2
    0 - None
    1 - Random Colors
    2 - Cvar: amx_grenade_color
    grenade_color "255000000" set the trail color of grenades
*/
 
#include <amxmodx>
#include <tfcx>
 
#define PLUGIN "Grenade Trail"
#define VERSION "1.0"
#define AUTHOR "Jim"
 
new g_cvar_tr
new g_cvar_color
new g_trail
 
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
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 
grenade_throw(idgidwid)
{
    new 
gtm get_pcvar_num(g_cvar_tr)
    if(!
gtm) return
    new 
rgb
    
switch(gtm)
    {
        case 
1:
        {
            
random(256)
            
random(256)
            
random(256)
        }
        case 
2:
        {
            new 
nadecolor[10]
            
get_pcvar_string(g_cvar_colorcolor9)
            new 
str_to_num(color)
            
1000000
            c 
%= 1000000 
            g 
1000
            b 
1000
        
}
    }
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW)
    
write_short(gid)
    
write_short(g_trail)
    
write_byte(10)
    
write_byte(5)
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(192)
    
message_end()


Last edited by potatis_invalido; 07-20-2007 at 21:08.
potatis_invalido is offline
SamuraiBarbi
Senior Member
Join Date: Aug 2006
Location: United States
Old 07-20-2007 , 21:59   Re: Grenade Trails
Reply With Quote #3

hmm, not quite working. what could be wrong?
SamuraiBarbi is offline
Send a message via AIM to SamuraiBarbi Send a message via MSN to SamuraiBarbi Send a message via Yahoo to SamuraiBarbi
Drak
Veteran Member
Join Date: Jul 2005
Old 07-21-2007 , 00:11   Re: Grenade Trails
Reply With Quote #4

Because, i think, the forward "Grenade_Throw" is not in TFC, only CS.
Thus, it never calls.

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/lol.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(equal(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()     } }

(In order for this code to work, you need to change "g_model" to the model you want to have a trail)
__________________
Oh yeah

Last edited by Drak; 07-21-2007 at 00:20.
Drak is offline
Send a message via MSN to Drak
SamuraiBarbi
Senior Member
Join Date: Aug 2006
Location: United States
Old 07-21-2007 , 00:40   Re: Grenade Trails
Reply With Quote #5

awww, i get the feeling it's close but when i compile the following

PHP 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(PLUGINVERSIONAUTHOR)
    
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(
equal(model,gModel)) 
    {
        new 
gtm get_pcvar_num(g_cvar_tr)
        if(!
gtm) return
        new 
rgb
        
switch(gtm)
        {
            case 
1:
            {
                
random(256)
                
random(256)
                
random(256)
            }
            case 
2:
            {
                new 
nadecolor[10]
                
get_pcvar_string(g_cvar_colorcolor9)
                new 
str_to_num(color)
                
1000000
                c 
%= 1000000 
                g 
1000
                b 
1000    
            
}
        }
        
message_begin(MSG_BROADCASTSVC_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()
    }

i get the following error code

home/groups/amxmodx/tmp3/text0SaysA.sma(0) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/text0SaysA.sma(1) : error 038: extra characters on line
/home/groups/amxmodx/tmp3/text0SaysA.sma(1) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/text0SaysA.sma(3) : error 001: expected token: ";", but found "-identifier-"
/home/groups/amxmodx/tmp3/text0SaysA.sma(3) : warning 203: symbol is never used: "c"
/home/groups/amxmodx/tmp3/text0SaysA.sma(3) : error 013: no entry point (no public functions)


what does that mean?
SamuraiBarbi is offline
Send a message via AIM to SamuraiBarbi Send a message via MSN to SamuraiBarbi Send a message via Yahoo to SamuraiBarbi
Drak
Veteran Member
Join Date: Jul 2005
Old 07-21-2007 , 00:44   Re: Grenade Trails
Reply With Quote #6

Compiles fine for me.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
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
Drak
Veteran Member
Join Date: Jul 2005
Old 07-21-2007 , 00:59   Re: Grenade Trails
Reply With Quote #8

Less indents to, lol.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
potatis_invalido
BANNED
Join Date: Jul 2007
Location: 0 (world)
Old 07-21-2007 , 01:05   Re: Grenade Trails
Reply With Quote #9

Quote:
Originally Posted by SixTwin View Post
Less indents to, lol.
Not any longeR

Last edited by potatis_invalido; 08-31-2007 at 16:51.
potatis_invalido is offline
SamuraiBarbi
Senior Member
Join Date: Aug 2006
Location: United States
Old 07-21-2007 , 01:09   Re: Grenade Trails
Reply With Quote #10

curious, either of you had the opportunity to this ingame yet?
SamuraiBarbi is offline
Send a message via AIM to SamuraiBarbi Send a message via MSN to SamuraiBarbi Send a message via Yahoo to SamuraiBarbi
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:19.


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