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

WeaponTrail


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alon
Member
Join Date: Jan 2011
Old 01-29-2011 , 10:33   WeaponTrail
Reply With Quote #1

hello everyone,
I was looking for WeaponTeail Plugin , and i found it :
https://forums.alliedmods.net/showthread.php?p=677111
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Weapon Trail"
#define VERSION "2.0"
#define AUTHOR "anakin_cstrike"

#define MAX_PLAYERS 32
#define OFFSET_ENT_TO_INDEX 43

enum droptype 
{
    
droptype_manual,
    
droptype_ondeath
}
new 
toggle,light,vel,g_max_clients,g_max_entities;

new const 
g_drop[] = "drop";
new const 
g_wbox_class[] = "weaponbox";
new const 
g_wbox_model[] = "models/w_weaponbox.mdl";
new const 
g_wbox_model_prefix[] = "models/w_";
new const 
g_start_client_index 1;
new 
g_command[MAX_PLAYERS 1][sizeof g_drop 1];
new 
g_trail,r,g,b;
public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_forward(FM_SetModel"fw_setmodel");
    
register_forward(FM_Touch,"fw_touch");
    
toggle register_cvar("weapontrail","1");
    
light register_cvar("weapontrail_light","1");
    
vel register_cvar("weapontrail_vel","1");
    
g_max_clients global_get(glb_maxClients);
    
g_max_entities global_get(glb_maxEntities);
}
public 
plugin_precache()
g_trail precache_model("sprites/smoke.spr");
public 
client_command(id
    
read_argv(0g_command[id], sizeof g_drop);
public 
fw_setmodel(ent, const model[])
{
    if(
get_pcvar_num(toggle) != 1)
        return 
FMRES_IGNORED;
    if(!
pev_valid(ent) || !equal(modelg_wbox_model_prefixsizeof g_wbox_model_prefix 1) || equal(modelg_wbox_model))
        return 
FMRES_IGNORED;    
    new 
id pev(entpev_owner)
    if(!(
g_start_client_index <= id <= g_max_clients))
        return 
FMRES_IGNORED;
    static class[
32],i;
    
pev(ent,pev_classname,class, sizeof class - 1)
    if(!
equal(class,g_wbox_class))
        return 
FMRES_IGNORED;
    for(
g_max_clients 1;g_max_entities;++i
    {
        if(!
pev_valid(i) || ent != pev(ipev_owner))
            continue;
        
        new 
wid get_pdata_int(i,OFFSET_ENT_TO_INDEX);
        if(
wid != CSW_C4)
        {
            new 
droptype:drop_type;
            if(!
is_user_alive(id))
                
drop_type droptype_ondeath;
            else if(
equal(g_command[id], g_drop))
                
drop_type droptype_manual;
            else
                return 
FMRES_IGNORED;
            switch(
drop_type)
            {
                case 
droptype_ondeath: {
                    if(
get_user_team(id) == 1){r=255;g=0;b=0;}
                    else if(
get_user_team(id) == 2){r=0;g=0;b=255;}
                }
                case 
droptype_manual: {
                    
random(255);
                    
random(255);
                    
random(255);
                }
            }
            if(
get_pcvar_num(vel) == 1)
            {
                new 
Float:vel[3];
                
vel[0] = float(random(300));
                
vel[1] = float(random(300));
                
vel[2] = float(random(300));
                
set_pev(ent,pev_velocity,vel);
            }
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
            
write_byte(TE_BEAMFOLLOW);
            
write_short(ent);
            
write_short(g_trail);
            
write_byte(5);
            
write_byte(5);
            
write_byte(r);
            
write_byte(g);
            
write_byte(b);
            
write_byte(195);
            
message_end();
        }
    }
    return 
FMRES_IGNORED;
}
public 
fw_touch(touchedtoucher)
{
    if(
get_pcvar_num(toggle) != 1)
        return 
FMRES_IGNORED;
    if(
get_pcvar_num(light) != 1)
        return 
FMRES_IGNORED;
    
    static class[
32];
    
pev(toucherpev_classname, class, sizeof class - 1);
    
    if(
containi(class, "weapon") != -&& !touched)
    {
        new 
Float:origin[3];
        
pev(toucherpev_originorigin);
            
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_DLIGHT);
        
write_coord(floatround(origin[0])); 
        
write_coord(floatround(origin[1])); 
        
write_coord(floatround(origin[2]));
        
write_byte(20);
        
write_byte(r);
        
write_byte(g);
        
write_byte(b);
        
write_byte(5);
        
write_byte(20);
        
message_end();
    }
    return 
FMRES_IGNORED;

But there is a problem , When I throw my weapon it goes crooked .

how can i fix it ?
Thanks to helpers.
Alon is offline
Old 01-30-2011, 07:09
Alon
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
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 00:19.


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