Raised This Month: $32 Target: $400
 8% 

drop weapon color


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakonda001
Member
Join Date: Jul 2020
Old 08-28-2020 , 06:56   drop weapon color
Reply With Quote #1

good day
how to make the weapon fall as usual, and then throws it to the side somewhere
https://forums.alliedmods.net/showthread.php?t=76649
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(PLUGIN, VERSION, AUTHOR);
	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(0, g_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(model, g_wbox_model_prefix, sizeof g_wbox_model_prefix - 1) || equal(model, g_wbox_model))
		return FMRES_IGNORED;	
	new id = pev(ent, pev_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(i = g_max_clients + 1;i < g_max_entities;++i) 
	{
		if(!pev_valid(i) || ent != pev(i, pev_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: {
					r = random(255);
					g = random(255);
					b = 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_BROADCAST, SVC_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(touched, toucher)
{
	if(get_pcvar_num(toggle) != 1)
		return FMRES_IGNORED;
	if(get_pcvar_num(light) != 1)
		return FMRES_IGNORED;
	
	static class[32];
	pev(toucher, pev_classname, class, sizeof class - 1);
	
	if(containi(class, "weapon") != -1 && !touched)
	{
		new Float:origin[3];
		pev(toucher, pev_origin, origin);
			
		message_begin(MSG_BROADCAST, SVC_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;
}

Last edited by anakonda001; 08-28-2020 at 07:36.
anakonda001 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-28-2020 , 08:04   Re: drop weapon color
Reply With Quote #2

What?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
anakonda001
Member
Join Date: Jul 2020
Old 08-28-2020 , 08:20   Re: drop weapon color
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
What?
when you throw away the weapon, it flies to the side, and you need to as usual in front of you
anakonda001 is offline
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 06:40.


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