Raised This Month: $32 Target: $400
 8% 

LongJump Icon


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Half-Life        Category:   Event Related        Approver:   Arkshine (91)
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-20-2012 , 04:42   LongJump Icon
Reply With Quote #1


Description:
Displays LJ icon, if player has it.
Screenshot


Changelog:
Attached Files
File Type: sma Get Plugin or Get Source (longjump_icon.sma - 2223 views - 871 Bytes)

Last edited by GordonFreeman (RU); 12-04-2013 at 23:33.
GordonFreeman (RU) is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-20-2012 , 05:28   Re: LongJump Icon
Reply With Quote #2

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.
__________________

Last edited by Arkshine; 02-20-2012 at 05:33.
Arkshine is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-20-2012 , 05:47   Re: LongJump Icon
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
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 View Post
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
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 02-20-2012 at 05:50.
GordonFreeman (RU) is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-20-2012 , 05:50   Re: LongJump Icon
Reply With Quote #4

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 ?
__________________

Last edited by Arkshine; 02-20-2012 at 05:54.
Arkshine is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-20-2012 , 05:54   Re: LongJump Icon
Reply With Quote #5

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
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 02-20-2012 at 06:00.
GordonFreeman (RU) is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-20-2012 , 05:58   Re: LongJump Icon
Reply With Quote #6

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.
__________________
Arkshine is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-20-2012 , 06:24   Re: LongJump Icon
Reply With Quote #7



damn english
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-20-2012 , 06:35   Re: LongJump Icon
Reply With Quote #8

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 ?
__________________

Last edited by Arkshine; 02-20-2012 at 06:45.
Arkshine is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-20-2012 , 07:21   Re: LongJump Icon
Reply With Quote #9

Quote:
Originally Posted by Arkshine View Post
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.
__________________
The functional way is the right way
GordonFreeman (RU) is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-22-2012 , 18:00   Re: LongJump Icon
Reply With Quote #10

Quote:
Originally Posted by Arkshine View Post
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
__________________

Last edited by tuty; 02-22-2012 at 18:00.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Reply


Thread Tools
Display Modes

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 19:31.


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