Raised This Month: $ Target: $400
 0% 

Orpheu tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-18-2014 , 08:17   Orpheu tag mismatch
Reply With Quote #1

I just started learning orpheu so I have no ideea why this code give a tag mismatch on the marked line.

Code:
#include <amxmodx> #include <orpheu> public plugin_init() {     new OrpheuFunction:Player_OnTouchingArmoury = OrpheuGetFunction("ArmouryTouch","CArmoury")     OrpheuRegisterHook(Player_OnTouchingArmoury,"OnTouchingArmoury", OrpheuHookPre) } public OnTouchingArmoury( id, iArmouryIndex ) {     return OrpheuSupercede }

Also, I have two more questions:
  • iArmouryIndex and id are never the same, even for the same weapon type. Why ?
  • What is the difference between a normal and a virtual function ? It doesn't count where I put the signature( in virtual functions or in the functions folder), it's working.
__________________

Last edited by HamletEagle; 08-18-2014 at 08:27.
HamletEagle is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 08-18-2014 , 08:33   Re: Orpheu tag mismatch
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <orpheu>

public plugin_init()
{
    new 
OrpheuFunction:Player_OnTouchingArmoury OrpheuGetFunction("ArmouryTouch","CArmoury")
    
OrpheuRegisterHook(Player_OnTouchingArmoury,"OnTouchingArmoury"OrpheuHookPre)
}

public 
OrpheuHookReturn:OnTouchingArmouryidiArmouryIndex )
{
    return 
OrpheuSupercede

__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-18-2014 , 08:58   Re: Orpheu tag mismatch
Reply With Quote #3

Thx you, now I understood what it was wrong.

Quote:
iArmouryIndex and id are never the same, even for the same weapon type. Why ?
What is the difference between a normal and a virtual function ? It doesn't count where I put the signature( in virtual functions or in the functions folder), it's working.
I will try to explain better what I need to know:

1.When I print it like this: "id: %i iArmouryIndex %i", id is different everytime and iArmouryIndex is the same. This makes me think that iArmouryIndex is the player id, and the id is the armoury index, so the function header should be( iArmouryIndex, id ). Is this right ?

Edit: Tested, it looks like the id is the second param. I still didn't figured why the armoury index is everytime different...

2. What is the difference between a "normal" function and a virtual one ?
__________________

Last edited by HamletEagle; 08-18-2014 at 10:25.
HamletEagle is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-18-2014 , 22:34   Re: Orpheu tag mismatch
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
What is the difference between a "normal" function and a virtual one ?
"Normal" functions are specific to their class, whereas virtual functions are defined in a base class and then redefined in it's extender classes. Therefore, the same function can be called by different classes and act accordingly to the way it has been implemented.

I'm pleased to see that another user has been converted to Orpheu Congrats.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 08-18-2014 at 22:35.
hornet is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 08-19-2014 , 05:13   Re: Orpheu tag mismatch
Reply With Quote #5

of course armoury_entity index is different each time, you are picking up different entities
baneado is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-19-2014 , 07:49   Re: Orpheu tag mismatch
Reply With Quote #6

Quote:
Originally Posted by baneado View Post
of course armoury_entity index is different each time, you are picking up different entities
You are right, I just confused it with something else, now it's fine.

Quote:
Originally Posted by hornet View Post
"Normal" functions are specific to their class, whereas virtual functions are defined in a base class and then redefined in it's extender classes. Therefore, the same function can be called by different classes and act accordingly to the way it has been implemented.

I'm pleased to see that another user has been converted to Orpheu Congrats.
Doing a simple plugin like this doesn't mean converted, in fact, I'm somehow confused by orpheu and I still have a lot of things to learn. Anyway, thx for your explanation, I think that now I get it.
__________________

Last edited by HamletEagle; 08-19-2014 at 07:50.
HamletEagle is offline
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 13:11.


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