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

AddToFullPack problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alphanumeric expression
New Member
Join Date: Nov 2008
Old 11-30-2008 , 19:13   AddToFullPack problem
Reply With Quote #1

The goal here is to make an entity glow when a player looks at one, and only show the glow for the player looking at the entity.

Code:
new g_GlowItem[33];
//...
register_forward(FM_PlayerPreThink, "fPrethink");
register_forward(FM_AddToFullPack, "fAddToFullPack", 1);
//...
public fPrethink(id)
{
	new Index, Body;
	get_user_aiming(id, Index, Body, 320);

	if(Index)
		g_GlowItem[id] = Index;
	else
		g_GlowItem[id] = -1;

	return FMRES_IGNORED;
}

public fAddToFullPack(State, E, Ent, Host, hFlags, Player, pSet)
{
	if(!Player)
		return FMRES_IGNORED;

	if(pev_valid(g_GlowItem[Ent]))
	{
		set_es(State, ES_RenderMode, kRenderNormal);
		set_es(State, ES_RenderAmt, 25);
		set_es(State, ES_RenderColor, {0, 80, 80});
		set_es(State, ES_RenderFx, kRenderFxGlowShell);
	}
	return FMRES_IGNORED;
}
Instead of the object glowing, the player does.

I've used three different sources as references.
alphanumeric expression is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-01-2008 , 00:03   Re: AddToFullPack problem
Reply With Quote #2

try if( g_GlowItem[Ent] == Host ) instead of the pev_valid check

Last edited by Emp`; 12-01-2008 at 01:44. Reason: forgot about the set_es having to be with es_handle
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 12-01-2008 , 00:38   Re: AddToFullPack problem
Reply With Quote #3

if(g_GlowItem[host] == Ent) and then use state not host ^^
afaik set_es has to be used with the state
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-01-2008 , 07:22   Re: AddToFullPack problem
Reply With Quote #4

Also, remove the "if( !Player )" check.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-01-2008 , 07:24   Re: AddToFullPack problem
Reply With Quote #5

Or change it to if( Player ) if you only want to make entities glowing and not players.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 07:02.


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