AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   engine changes to pfn touch (https://forums.alliedmods.net/showthread.php?t=288)

DopeFish 03-17-2004 17:06

engine changes to pfn touch
 
A small test code using engine functions:
Code:
public pfn_touch(pToucher, pTouched) {         new itemClassName[MAX_NAME_LENGTH], playerClassname[MAX_NAME_LENGTH]         entity_get_string(pToucher, EV_SZ_classname, itemClassName, MAX_NAME_LENGTH-1);         entity_get_string(pTouched, EV_SZ_classname, playerClassname, MAX_NAME_LENGTH-1)         client_print(0, print_chat, "[AMXX-DEBUG] %s touched %s",playerClassname,itemClassName) }

I get the error:
Code:

test.sma(19) : error 025: function heading differs from prototype
usind the "old" vexd version works fine
Code:
public vexd_pfntouch(pToucher, pTouched) {

so what was changed to the function? and how would a correct usage of pfn_touch look like?

PM 03-18-2004 07:07

public pfn_touch(ptr, ptd)

BAILOPAN 03-18-2004 09:24

Also be careful: It's a full forward now. return PLUGIN_HANDLED will block the call from the hl engine

MagicShot 03-18-2004 10:18

Quote:

Originally Posted by BAILOPAN
Also be careful: It's a full forward now. return PLUGIN_HANDLED will block the call from the hl engine

Bail whats the difference wetween a forward and a stock and natives?

PM 03-18-2004 10:28

well all of them are functions
forward: caller: amxx / a module; it is in a plugin
stock: it is normally in a .inc file, caller is the plugin, it is only included to the code if the plugin uses it
native: it is in a module or amxx core, the caller is the plugin

MagicShot 03-18-2004 10:32

umm
 
So Why does a forward block a call from the hl engine?

PM 03-18-2004 10:45

this forward is called directly from a Metamod hook function. If any pfn_touch function returns PLUGIN_HANDLED, the engine module returns MRES_SUPERCEDE to metamod, which causes the function in the dll not to be called.

MagicShot 03-18-2004 10:54

hmm
 
Quote:

Originally Posted by PM
this forward is called directly from a Metamod hook function. If any pfn_touch function returns PLUGIN_HANDLED, the engine module returns MRES_SUPERCEDE to metamod, which causes the function in the dll not to be called.

So if Yout put it in the return PLUGIN_HANDLED in the correct place the forward basically is null as far as doing anything?

correct?

DopeFish 03-18-2004 12:39

Quote:

Originally Posted by PM
public pfn_touch(ptr, ptd)

I feel so dumb right now, I had the solution in front of me the whole time and didn't see it

PM 03-18-2004 12:42

Quote:

Originally Posted by DopeFish
Quote:

Originally Posted by PM
public pfn_touch(ptr, ptd)

I feel so dumb right now, I had the solution in front of me the whole time and didn't see it

no problem :) it is only logical that the parameter names may change...
MagicShot: i don't understand your question


All times are GMT -4. The time now is 16:23.

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