AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to hook tempentities proberly? (https://forums.alliedmods.net/showthread.php?t=105407)

tolsty 10-04-2009 09:19

How to hook tempentities proberly?
 
i want to block these messages, but i had no luck :P
TE_GUNSHOT 2
TE_SPARKS 9
TE_GUNSHOTDECAL 109
TE_ARMOR_RICOCHET 111
TE_MULTIGUNSHOT 126

PHP Code:

new const BULLETMSG = (TE_GUNSHOT TE_SPARKS TE_GUNSHOTDECAL TE_ARMOR_RICOCHET TE_MULTIGUNSHOT)
public 
plugin_init() {
 
register_messageSVC_TEMPENTITY ,"hidebullet"
}

public 
hidebullet msg_idmsg_typemsg_entity)
{

   if ( 
get_msg_arg_int ) == BULLETMSG )
   {
      
// Block
   


Please show me a full example how to Hook those messages and block them .

P.S. Admins, please correct the typo in the thread title :D

Exolent[jNr] 10-04-2009 13:45

Re: How to hook tempentities proberly?
 
Code:
#include < amxmodx > new const g_iBlockMessages[ ] = {     TE_GUNSHOT,     TE_SPARKS,     TE_GUNSHOTDECAL,     TE_ARMOR_RICOCHET,     TE_MULTIGUNSHOT }; new Trie:g_tBlockMessages; public plugin_init( ) {     g_tBlockMessages = TrieCreate( );         new szMessage[ 2 ];     for( new i = 0; i < sizeof( g_iBlockMessages ); i++ ) {         szMessage[ 0 ] = g_iBlockMessages[ i ];         TrieSetCell( g_tBlockMessages, szMessage, i );     }         register_message( SVC_TEMPENTITY, "MessageTempEntity" ); } public plugin_end( ) {     TrieDestroy( g_tBlockMessages ); } public MessageTempEntity( ) {     static szMessage[ 2 ];     szMessage[ 0 ] = get_msg_arg_int( 1 );         if( TrieKeyExists( g_tBlockMessages, szMessage ) ) {         return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; }

Jon 10-04-2009 13:51

Re: How to hook tempentities proberly?
 
I don't think trie is a good way to do this

Exolent[jNr] 10-04-2009 13:52

Re: How to hook tempentities proberly?
 
Quote:

Originally Posted by Jon (Post 952278)
I don't think trie is a good way to do this

Why?

ot_207 10-04-2009 13:59

Re: How to hook tempentities proberly?
 
Quote:

Originally Posted by Jon (Post 952278)
I don't think trie is a good way to do this

I am affraid that Exolents way is the only way because tempents don't exist as ents do.

tolsty 10-04-2009 14:55

Re: How to hook tempentities proberly?
 
Thanx, but it didnt work :(
what i need is to hide the bullet effects, but leave the model animations

Arkshine 10-04-2009 15:01

Re: How to hook tempentities proberly?
 
Use FM_TraceLine.

Arkshine 10-04-2009 15:42

Re: How to hook tempentities proberly?
 
BULLETMSG are not a bits sum.

ConnorMcLeod 10-04-2009 15:45

Re: How to hook tempentities proberly?
 
Quote:

Originally Posted by Arkshine (Post 952403)
BULLETMSG are not a bits sum.

OMG edited.
I guess we can't make it a bitsum due to max cell value.

tolsty 10-04-2009 17:21

Re: How to hook tempentities proberly?
 
i tried using traceline but it didnt work,
the trace gets redirected, but the gunfire decal and the sparks stays right where they should normaly be :?
example:
PHP Code:

public plugin_init()
    
register_forward(FM_TraceLine,"fw_traceline");

public 
fw_traceline(Float:start[3], Float:end[3], conditionsidtrace)
{
    
set_tr2(traceTR_pHitid)


i redirected every hit to my self, if i shoot i loose hp and everything, but the effect is on the wall :cry:


All times are GMT -4. The time now is 22:40.

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