AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Orpheu tag mismatch (https://forums.alliedmods.net/showthread.php?t=246493)

HamletEagle 08-18-2014 08:17

Orpheu tag mismatch
 
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.

Bos93 08-18-2014 08:33

Re: Orpheu tag mismatch
 
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



HamletEagle 08-18-2014 08:58

Re: Orpheu tag mismatch
 
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 ?

hornet 08-18-2014 22:34

Re: Orpheu tag mismatch
 
Quote:

Originally Posted by HamletEagle (Post 2185712)
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 :up: Congrats.

baneado 08-19-2014 05:13

Re: Orpheu tag mismatch
 
of course armoury_entity index is different each time, you are picking up different entities

HamletEagle 08-19-2014 07:49

Re: Orpheu tag mismatch
 
Quote:

Originally Posted by baneado (Post 2186099)
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 (Post 2186039)
"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 :up: 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. :up:


All times are GMT -4. The time now is 13:11.

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