AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   LongJump Icon (https://forums.alliedmods.net/showthread.php?t=178727)

GordonFreeman (RU) 02-20-2012 04:42

LongJump Icon
 
3 Attachment(s)

Description:
Displays LJ icon, if player has it.


Changelog:

Arkshine 02-20-2012 05:28

Re: LongJump Icon
 
Looking at the HL code, it does already show the icon, what is the point of your plugin ?

With your code, it hooks when the message ItemPickup is sent, to sent again the message... It doesn't make sense.

Don't use EngFunc_RegUserMsg because such message is already registered, you should use get_user_msgid.
And there is no point to use EngFunc_MessageBegin here instead of message_begin.

GordonFreeman (RU) 02-20-2012 05:47

Re: LongJump Icon
 
Quote:

Originally Posted by Arkshine (Post 1653864)
Don't use EngFunc_RegUserMsg because such message is already registered, you should use get_user_msgid.

Sure?
Code:

L 02/20/2012 - 15:46:02: Plugin called message_begin with an invalid message id (0).
L 02/20/2012 - 15:46:02: [AMXX] Displaying debug trace (plugin "longjump_icon.amxx")
L 02/20/2012 - 15:46:02: [AMXX] Run time error 10: native error (native "message_begin")
L 02/20/2012 - 15:46:02: [AMXX]    [0] longjump_icon.sma::showicon

look all registred messages in hl by "meta game" command and there is no "StatusIcon" message.

Quote:

Originally Posted by Arkshine (Post 1653864)
And there is no point to use EngFunc_MessageBegin here instead of message_begin.

Look what i get with message_begin instead of EngFunc_MessageBegin:
Code:

L 02/20/2012 - 15:49:06: Plugin called message_begin with an invalid message id (101).
L 02/20/2012 - 15:49:06: [AMXX] Displaying debug trace (plugin "longjump_icon.amxx")
L 02/20/2012 - 15:49:06: [AMXX] Run time error 10: native error (native "message_begin")
L 02/20/2012 - 15:49:06: [AMXX]    [0] longjump_icon.sma::showicon


Arkshine 02-20-2012 05:50

Re: LongJump Icon
 
Don't know what you've done but here the code (edit : why hooking in precache ?)

Code:
class CItemLongJump : public CItem {     void Spawn( void )     {         Precache( );         SET_MODEL(ENT(pev), "models/w_longjump.mdl");         CItem::Spawn( );     }     void Precache( void )     {         PRECACHE_MODEL ("models/w_longjump.mdl");     }     BOOL MyTouch( CBasePlayer *pPlayer )     {         if ( pPlayer->m_fLongJump )         {             return FALSE;         }         if ( ( pPlayer->pev->weapons & (1<<WEAPON_SUIT) ) )         {             pPlayer->m_fLongJump = TRUE;// player now has longjump module             g_engfuncs.pfnSetPhysicsKeyValue( pPlayer->edict(), "slj", "1" );             MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev );                 WRITE_STRING( STRING(pev->classname) );             MESSAGE_END();             EMIT_SOUND_SUIT( pPlayer->edict(), "!HEV_A1" ); // Play the longjump sound UNDONE: Kelly? correct sound?             return TRUE;                }         return FALSE;     } };

And you don't understand register_event("ItemPickup","showicon","b","1 &item_longjump") means AMXX hooks ItemPickup message, meaning this message is already registered and can be hooked. In other words, ItemPickup is sent, Amxx catches it, then you send again the message.. What is the point ?

GordonFreeman (RU) 02-20-2012 05:54

Re: LongJump Icon
 
I don't understand you. I just hooking ItemPickup for lj pickup. I registering StatusIcon message, because there is no in hl.
Look plugin with this hook

Arkshine 02-20-2012 05:58

Re: LongJump Icon
 
I guess you don't know what you're doing and your plugin doesn't make sense.
If you don't understand what I've said, I don't how I could explain.

Will try again :

- Such message is already sent by the game.
- Your code hooks when such message is sent by the game, and you send again the message.
- About RegUserMsg, just don't hook an event in precache time. Really, what are you doing ?

Unapproved.

GordonFreeman (RU) 02-20-2012 06:24

Re: LongJump Icon
 
http://s.qip.ru/3049gLi.jpg

damn english

Arkshine 02-20-2012 06:35

Re: LongJump Icon
 
Just seen, you send StatusIcon and not ItemPickup. What a big fail. My bad. I thought you were sending again ItemPickup, that's why I did not understand at all. Sorry.

So, yes the code is correct since the client supports StatusIcon but the server doesn't register it.
Do you use EngFunc_MessageBegin because of a specific reason ?

GordonFreeman (RU) 02-20-2012 07:21

Re: LongJump Icon
 
Quote:

Originally Posted by Arkshine (Post 1653884)
Do you use EngFunc_MessageBegin because of a specific reason ?

By default "StatusIcon" message not registered in HL (like "ShowMenu").
message_begin works only with defaults messages.

tuty 02-22-2012 18:00

Re: LongJump Icon
 
Quote:

Originally Posted by Arkshine (Post 1653864)
Looking at the HL code, it does already show the icon, what is the point of your plugin ?

it shows only for a few seconds, like any item picking up:)


All times are GMT -4. The time now is 18:32.

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