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

Solved TR_TraceRayFilter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-12-2017 , 13:38   TR_TraceRayFilter
Reply With Quote #1

TR_TraceRayFilter(start, angle, MASK_SOLID, RayType_Infinite, TraceEntityFilterPlayer, client);
How to make this dont hit this:
Code:
int entity = CreateEntityByName("prop_physics_override");
if (IsValidEntity(entity)) 
{
	SetEntityModel(entity, "models/props/de_train/vending/vending_machine_old.mdl");
	SetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity", client);
	SetEntProp(entity, Prop_Data, "m_CollisionGroup", 1);
	SetVariantString("!activator");
	AcceptEntityInput(entity, "SetParent", client);
	DispatchSpawn(entity);
	SetEntityMoveType(entity, MOVETYPE_NONE);
	SetEntPropEnt(entity, Prop_Data, "m_hLastAttacker", client);
	SetEntityRenderMode(entity, RENDER_TRANSCOLOR);

Last edited by Indarello; 08-13-2017 at 11:54.
Indarello is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 08-12-2017 , 13:40   Re: TR_TraceRayFilter
Reply With Quote #2

Can you give more details on what should be hit and what not?

Here is a full list of all masks: https://github.com/alliedmodders/sou...ools_trace.inc
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...
Totenfluch is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-12-2017 , 13:45   Re: TR_TraceRayFilter
Reply With Quote #3

TR_TraceRayFilter(start, angle, MASK_SOLID, RayType_Infinite, TraceEntityFilterPlayer, client);
I use to create props on map, like vending_machine, cinderblock_stack
it should hit walls, props,...
the problem is : player are in the vending_machine prop, so when i trace, it hit to close to player to create prop
because it hits vending_machine where the player are
Indarello is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 08-12-2017 , 14:22   Re: TR_TraceRayFilter
Reply With Quote #4

Use an entity filter

PHP Code:
stock bool TRDontHitEntities(int entityint maskany data) {
    if (!
isValidClient(entity))
        return 
false;
    return 
true;
}

stock bool isValidClient(int client) {
    return (
<= client <= MaxClients && IsClientInGame(client));

__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...
Totenfluch is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-12-2017 , 23:39   Re: TR_TraceRayFilter
Reply With Quote #5

Quote:
Originally Posted by Totenfluch View Post
Use an entity filter

PHP Code:
stock bool TRDontHitEntities(int entityint maskany data) {
    if (!
isValidClient(entity))
        return 
false;
    return 
true;
}

stock bool isValidClient(int client) {
    return (
<= client <= MaxClients && IsClientInGame(client));

Please more info how to use it in code, and i mean trace must go through
Indarello is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-13-2017 , 11:54   Re: TR_TraceRayFilter
Reply With Quote #6

Okey thanks, this working:
Code:
public bool:TraceEntityFilterPlayer(entity, contentsMask, any:data)
{
	if (IsValidClient(entity)) return false;
	if (GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity") == data) return false;
	return true;
}
Indarello 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 23:37.


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