Raised This Month: $ Target: $400
 0% 

Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Skeetles
BANNED
Join Date: Jul 2005
Old 12-11-2005 , 19:37   Help
Reply With Quote #1

It compiles and runs but nothing happens.
(tracers work)
Supposed to
1) conc all players when they are shot
2)don't take damage from shots
3)give unlimited ammo

Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>
#include <amxmisc>
#include <fun>
new lastammo[33]
new lastweap[33]

public plugin_init()
{
	register_event("CurWeapon","tracers","be","1=1")
	register_plugin("Skeetles","ConcMod","1.0")
	register_event("Damage", "hit_person", "b", "2!0", "4!0", "5!0", "6!0")
	register_cvar("amx_conc","20.0")
	register_forward(FM_TraceLine, "forward_traceline", 1)
	register_cvar("amx_concammo","1")

}

public tracers(id)
{
new weap = read_data(2)
new ammo = read_data(3)

if(lastweap[id] == 0) lastweap[id] = weap
	if((lastammo[id] > ammo) && (lastweap[id] == weap)) 
	{
		new vec1[3], vec2[3]
		get_user_origin(id, vec1, 1)
		get_user_origin(id, vec2, 4)
		vec1[2] -= 6
		message_begin(MSG_ALL, SVC_TEMPENTITY,vec1 )
      		write_byte(6)
      		write_coord(vec1[0])
      		write_coord(vec1[1])
      		write_coord(vec1[2])
      		write_coord(vec2[0])
      		write_coord(vec2[1])
      		write_coord(vec2[2])
      		message_end()
	}
	
	
	lastammo[id] = ammo
	lastweap[id] = weap
	return PLUGIN_CONTINUE
}

stock set_velocity_from_origin( ent, Float:fOrigin[3], Float:fSpeed )
{
	new Float:fVelocity[3];
	get_velocity_from_origin( ent, fOrigin, fSpeed, fVelocity )

	entity_set_vector( ent, EV_VEC_velocity, fVelocity );

	return ( 1 );
} 
stock get_velocity_from_origin( ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3] )
{
	new Float:fEntOrigin[3];
	entity_get_vector( ent, EV_VEC_origin, fEntOrigin );

    // Velocity = Distance / Time

	new Float:fDistance[3];
	fDistance[0] = fEntOrigin[0] - fOrigin[0];
	fDistance[1] = fEntOrigin[1] - fOrigin[1];
	fDistance[2] = fEntOrigin[2] - fOrigin[2];
	
	new Float:fTime = ( vector_distance( fEntOrigin,fOrigin ) / fSpeed );
	
	fVelocity[0] = fDistance[0] / fTime;
	fVelocity[1] = fDistance[1] / fTime;
	fVelocity[2] = fDistance[2] / fTime;

	return ( fVelocity[0] && fVelocity[1] && fVelocity[2] );
}
public hit_person(id)
{
	new MAXPLAYERS
	MAXPLAYERS = get_maxplayers()

	new inflictor = entity_get_edict(id, EV_ENT_dmg_inflictor)
	if (inflictor <= MAXPLAYERS)
	        return PLUGIN_CONTINUE

	
	
	new Float:upVector[3]
	upVector[0] = float(read_data(4))
	upVector[1] = float(read_data(5))
	upVector[2] = float(read_data(6))

	new damagerept = read_data(2)
	set_velocity_from_origin(id, upVector, get_cvar_float("amx_conc")*damagerept)

	return PLUGIN_CONTINUE
}
public forward_traceline(Float:v1[3], Float:v2[3], noMonsters, id) 
{ 
	if(!!is_user_connected(id) || !is_user_alive(id)) 
		return FMRES_IGNORED; 

	new iVictim = get_tr(TR_pHit); 

	if(!is_user_connected(iVictim) || !is_user_alive(iVictim)) 
		return FMRES_IGNORED; 

	new iHitPlace = get_tr(TR_iHitgroup); 

	if(iHitPlace == HIT_HEAD || iHitPlace == HIT_CHEST/*ect!*/) 
	{ 
		set_tr(TR_iHitgroup, HIT_GENERIC); 
	} 

	return FMRES_IGNORED; 
}
Yes I stole code, I am a code bandit and I feel oh so guilty.
Skeetles is offline
Skeetles
BANNED
Join Date: Jul 2005
Old 12-11-2005 , 22:28  
Reply With Quote #2

Don't look at the last part, I did not mean to add that, I know why it isn't working. But the conc still is annoying me.
Skeetles 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 16:11.


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