Raised This Month: $12 Target: $400
 3% 

Solved [Grenade Trail] Only for DEAD/SPEC


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xonfire
Member
Join Date: Sep 2020
Old 11-28-2020 , 10:14   [Grenade Trail] Only for DEAD/SPEC
Reply With Quote #1

Hello, I would like the trail of the grenades to be seen only by those who are dead and spectators, I found a plugin of (csgo grenade trail) but the trail lines stay a long time, I leave the plugin of which I want you to help me thanks.

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 <csx>

#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()


Last edited by xonfire; 11-28-2020 at 13:51.
xonfire is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-28-2020 , 10:49   Re: [Grenade Trail] Only for DEAD/SPEC
Reply With Quote #2

PHP Code:
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
            
}
        }
    }

    new 
players[32], pnum;
    
get_players(playerspnum"dc");

    for( new 
ipnumi++)
    {
       
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_players[i])
       
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()
    }

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-28-2020 at 15:21.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
xonfire
Member
Join Date: Sep 2020
Old 11-28-2020 , 11:18   Re: [Grenade Trail] Only for DEAD/SPEC
Reply With Quote #3

Thank you for your prompt response Natsheh when compiling I got this error in console:

Code:
error 035: argument type mismatch (argument 1)
In this line

PHP Code:
get_user_name(playerspnum"cd"); 
xonfire is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-28-2020 , 11:49   Re: [Grenade Trail] Only for DEAD/SPEC
Reply With Quote #4

PHP Code:
get_user_name(playerspnum"cd"); 
-->

PHP Code:
get_players(playerspnum"cd"); 
__________________

Last edited by Napoleon_be; 11-28-2020 at 11:49.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
xonfire
Member
Join Date: Sep 2020
Old 11-28-2020 , 12:12   Re: [Grenade Trail] Only for DEAD/SPEC
Reply With Quote #5

Thank you Napoleon_be it was compiled correctly, instead of "cd" it would be "bc" is working thanks to both of them for their time.

Last edited by xonfire; 11-28-2020 at 13:50.
xonfire is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-28-2020 , 15:21   Re: [Grenade Trail] Only for DEAD/SPEC
Reply With Quote #6

Lmao I didn't even notice I wrote it on the phone which it's pain in the ass

btw the flags "cd" also should work...
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-28-2020 at 18:41.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply


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


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