It is currently Fri Sep 10, 2010 7:54 am




Post new topic Reply to topic  [ 8 posts ] 
HookSingleEntityOutput not working... 
Author Message
Community Member
Community Member
Austria

Joined: Sun Sep 27, 2009 11:30 pm
Posts: 32
Given: 0 thanks
Received: 1 thanks
Post HookSingleEntityOutput not working...
Hi everybody,

I wrote a Plugin where i need to know when an entity is touched. I tryed it this way:

Code:

new flag = CreateEntityByName("prop_physics_override");
       
SetEntityModel(flag,axisFlag);
mainTeamFlagAx = flag;
               
SetEntProp(mainTeamFlagAx, Prop_Send, "m_nSkin", flagSkin[team])
               
DispatchSpawn(mainTeamFlagAx)
TeleportEntity(mainTeamFlagAx, vec, NULL_VECTOR, NULL_VECTOR)
               
HookSingleEntityOutput(mainTeamFlagAx, "OnTouchedByEntity", EntityOutput:EntityOutput_OnFlagStolen);
               
PaintFlag(mainTeamFlagAx, true);

...

public Action:EntityOutput_OnFlagStolen(const String:output[], client, flag)
{
//Do stuff
}

 


But the callbackfunction is not called...

I also tryed Dukehacks with the same result.

I hope somebody can help me...

Thx for the Help in advance,
Metabolic


Sat Jan 02, 2010 11:38 pm
Profile
Developer
Developer
User avatar

Joined: Mon Oct 20, 2008 5:27 pm
Posts: 1051
Age: 27
Location: Germany
Given: 27 thanks
Received: 141 thanks
Steam Friends: FireStorm2k5
Post Re: HookSingleEntityOutput not working...
Output hooks are broken in SM 1.2.X but have been fixed in 1.3.0:
Quote:
Fixed entity output hooks not working


I have never had a problem with "dhHookEntity(entity, EHK_Touch, myfunction)" though,
using it in various plugins and it works fine ;)

_________________
- We have open positions as Developers & Beta Testers! Click HERE!
- Please consider to support DoD: Source Plugins to keep it alive and enhance it! Read more HERE!
- Try our MultiVersion SourceMod WebCompiler HERE!



Tue Jan 19, 2010 7:46 am
Profile WWW
Community Member
Community Member
Austria

Joined: Sun Sep 27, 2009 11:30 pm
Posts: 32
Given: 0 thanks
Received: 1 thanks
Post Re: HookSingleEntityOutput not working...
hi FeuerSturm,

Thanks for your answer!

but i'm sorry i dont get it to work...
I already tryed "dhHookEntity".

But it doesnot work with HookSingleEntityOutput in the current 1.3.1 version of sourcemod either so the bug must be anywhere else...


Last edited by Austria Metabolic on Thu Mar 11, 2010 6:17 pm, edited 1 time in total.

Tue Jan 19, 2010 8:08 pm
Profile
Developer
Developer
User avatar

Joined: Mon Oct 20, 2008 5:27 pm
Posts: 1051
Age: 27
Location: Germany
Given: 27 thanks
Received: 141 thanks
Steam Friends: FireStorm2k5
Post Re: HookSingleEntityOutput not working...
After the flags are spawned, can you just run through them, or do you get stuck?

Reason I'm asking is: It seems that ONLY solid entities triggger the touch hooks, you might
need to make it solid if it isn't to get it to work.

_________________
- We have open positions as Developers & Beta Testers! Click HERE!
- Please consider to support DoD: Source Plugins to keep it alive and enhance it! Read more HERE!
- Try our MultiVersion SourceMod WebCompiler HERE!



Thu Jan 21, 2010 7:21 am
Profile WWW
Community Member
Community Member
Austria

Joined: Sun Sep 27, 2009 11:30 pm
Posts: 32
Given: 0 thanks
Received: 1 thanks
Post Re: HookSingleEntityOutput not working...
hi,

I can run through them.

Sry for the stupid question but how do i create a solid entity? :)
Could you give me a sample please?

Thanks,
Metabolic


Fri Jan 22, 2010 12:43 am
Profile
Community Member
Community Member
Austria

Joined: Sun Sep 27, 2009 11:30 pm
Posts: 32
Given: 0 thanks
Received: 1 thanks
Post Re: HookSingleEntityOutput not working...
hello?

sry i cant find anything on how to create a solid entity.

i would be very thankful if somebody would give me a sample or link.

thx,
Metabolic


Sun Feb 28, 2010 9:20 pm
Profile
Developer
Developer
User avatar

Joined: Tue Oct 21, 2008 10:37 pm
Posts: 79
Location: Vancouver BC
Given: 1 thanks
Received: 6 thanks
Post Re: HookSingleEntityOutput not working...
As for touching entities, I use SDKHooks as I find it more stable than DukeHacks.

This little snippet spawns an ammo box which then fires when touched.
From my Zombie code...
Code:

public Action:SpawnAmmoBox(Handle:timer, any:client)
{
        new Float: ClientOrigin[3];

        if (IsClientInGame(client))
        {
                GetClientAbsOrigin(client, ClientOrigin);
               
                g_AmmoBoxNumber++;

                new ent = CreateEntityByName("prop_physics_override");
                SetEntityModel(ent, "models/ammo/ammo_axis.mdl");      
                new String:ammoname[16];
                Format(ammoname, sizeof(ammoname), "Ammo%i", g_AmmoBoxNumber);
                DispatchKeyValue(ent, "StartDisabled", "false");
                DispatchKeyValue(ent, "targetname", ammoname);
                SetEntityMoveType(ent, MOVETYPE_VPHYSICS);
                SetEntProp(ent, Prop_Data, "m_CollisionGroup", DROP_COLLISION);
                SetEntProp(ent, Prop_Data, "m_usSolidFlags", 28);
                SetEntProp(ent, Prop_Data, "m_nSolidType", 6);
               
                DispatchSpawn(ent);
                TeleportEntity(ent, ClientOrigin, NULL_VECTOR, NULL_VECTOR);
               
                SDKHook(ent, SDKHook_Touch, TouchHookAmmo);
                       
                new String:addoutput[64];
                Format(addoutput, sizeof(addoutput), "OnUser1 !self:kill::%f:1", 10.0);
                SetVariantString(addoutput);
                AcceptEntityInput(ent, "AddOutput");
                AcceptEntityInput(ent, "FireUser1");
        }
       
        return Plugin_Handled;
}

public Action:TouchHookAmmo(entity, client)
{
        if (client > 0 && client <= MaxClients)
        {
                if (GetClientTeam(client) == 2)
                        AddAmmo(client);
                               
                CreateTimer(0.01, DestroyEntity, entity);
        }
        return Plugin_Handled;
}


Hope this helps.

_________________
Image

http://www.boff.ca/dogblog

Left4DoD: the new Zombie Mod for DoDS


Tue Mar 02, 2010 5:26 am
Profile WWW
Developer
Developer
User avatar

Joined: Wed Nov 19, 2008 12:25 am
Posts: 147
Given: 4 thanks
Received: 9 thanks
Post Re: HookSingleEntityOutput not working...
The model needs to have a physics box else you will run through it and touch wont be triggered.
I got same problem with: weapon_amerknife / weapon_spade / weapon_colt


Fri Apr 02, 2010 10:51 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forum/DivisionCore.