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

Event touch with not solid entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Frenzzy
SourceMod Donor
Join Date: Jan 2007
Location: Russia
Old 06-04-2011 , 05:26   Event touch with not solid entity
Reply With Quote #1

How can I get event when a player touches an not solid entity?


PHP Code:
// ...

new entity CreateEntityByName("flashbang_projectile");
if ((
entity != -1) && DispatchSpawn(entity))
{
    
SetEntityModel(entity"models/bigball.mdl"); // Big model
    
SetEntProp(entityProp_Send"m_CollisionGroup"2); // Set no solid
    
TeleportEntity(entityfPosNULL_VECTORNULL_VECTOR); // Teleport to player
    
SDKHook(entitySDKHook_StartTouchOnStartTouch); // Hook touch event
}

// ...

public OnStartTouch(entityclient)
{
    if (!
IsValidEntity(client))
        return;
    
    
decl String:classname[32];
    
GetEdictClassname(clientclassnamesizeof(classname));
    
    
PrintToChatAll("EntityName toched %s"classname);
    
// We need to get: "EntityName toched Player"

Frenzzy is offline
Send a message via ICQ to Frenzzy Send a message via MSN to Frenzzy Send a message via Skype™ to Frenzzy
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-04-2011 , 08:48   Re: Event touch with not solid entity
Reply With Quote #2

Try collisiongroup 1, not 2. At least thats what I seem to use for non-solid, touch.
__________________
Silvers is offline
Frenzzy
SourceMod Donor
Join Date: Jan 2007
Location: Russia
Old 06-05-2011 , 07:07   Re: Event touch with not solid entity
Reply With Quote #3

Silvers,

thanks, this helped:

PHP Code:
SetEntProp(entityProp_Send"m_usSolidFlags"12); // FSOLID_NOT_SOLID|FSOLID_TRIGGER
SetEntProp(entityProp_Data"m_nSolidType"6); // SOLID_VPHYSICS
SetEntProp(entityProp_Send"m_CollisionGroup"1); // COLLISION_GROUP_DEBRIS 

Now I can't get my entity using the trace (ray tests):

PHP Code:
// ...

decl Float:angles[3], Float:origin[3];
GetClientEyePosition(clientorigin);
GetClientEyeAngles(clientangles);

new 
Handle:trace TR_TraceRayFilterEx(originanglesMASK_ALLRayType_InfiniteTraceEntityFilterPlayer);

if (
TR_DidHit(trace)) {
    new 
entity TR_GetEntityIndex(trace);
    
CloseHandle(trace);

    
decl String:targetname[32], String:classname[32];
    
GetEntPropString(entityProp_Data"m_iName"targetnamesizeof(targetname));
    
GetEntPropString(entityProp_Data"m_iClassname"classnamesizeof(classname));
    
PrintToChatAll("Entity: %s %s"classnametargetname);
    
// When I look at my entity I get this: "Entity: worldspawn "
}

// ...

public bool:TraceEntityFilterPlayer(entitycontentsMask) {
    return 
entity MaxClients;

I need your help again..
Frenzzy is offline
Send a message via ICQ to Frenzzy Send a message via MSN to Frenzzy Send a message via Skype™ to Frenzzy
lokizito
Veteran Member
Join Date: Dec 2010
Location: Brazil
Old 06-05-2011 , 08:26   Re: Event touch with not solid entity
Reply With Quote #4

If what you want is to see what touched into the projectile, you can get it only with the SDKHooks StartTouch (entity, other)
__________________
[CS:S] RankMe - Why pay for a rank plugin if you can have one for free?
[CS:S] RankMe Connect Announcer - Announce when a player connect
Translation Project - Let's make the plugins to be international
lokizito is offline
Frenzzy
SourceMod Donor
Join Date: Jan 2007
Location: Russia
Old 06-05-2011 , 11:43   Re: Event touch with not solid entity
Reply With Quote #5

With the touch, I figured. Now I want to display a hint when the player looks at the entity. Something like as a spray trace plugin hints. But GetClientAimTarget(client, false) does not find my flashbang_projectile entity.
Frenzzy is offline
Send a message via ICQ to Frenzzy Send a message via MSN to Frenzzy Send a message via Skype™ to Frenzzy
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-05-2011 , 12:20   Re: Event touch with not solid entity
Reply With Quote #6

Why don't you help everyone else who views this by posting your solution, then maybe someone else will help you again.
__________________
Silvers is offline
Frenzzy
SourceMod Donor
Join Date: Jan 2007
Location: Russia
Old 11-07-2011 , 18:55   Re: Event touch with not solid entity
Reply With Quote #7

Here is what I got
Frenzzy is offline
Send a message via ICQ to Frenzzy Send a message via MSN to Frenzzy Send a message via Skype™ to Frenzzy
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:01.


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