AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   register_touch.. in fakemeta? (https://forums.alliedmods.net/showthread.php?t=83447)

tuty 01-09-2009 19:39

register_touch.. in fakemeta?
 
Hi i want to convert this in fakemeta or hamsandwich

PHP Code:

register_touch("func_breakable""player""something"); 

how :-?

zwfgdlc 01-09-2009 19:46

Re: register_touch.. in fakemeta?
 
PHP Code:

#include <fakemeta>
register_forward(FM_Touch,"fw_Touch"); 

PHP Code:

#include <hamsandwich>
RegisterHam(Ham_Touch,"player","fw_Touch"


Exolent[jNr] 01-09-2009 19:47

Re: register_touch.. in fakemeta?
 
Fakemeta:

Code:
public plugin_init() {     register_forward(FM_Touch, "FwdTouch"); } public FwdTouch(ptr, ptd) {     if( pev_valid(ptr) && pev_valid(ptd) )     {         static classname1[32], classname2[32];         pev(ptr, pev_classname, classname1, sizeof(classname1) - 1);         pev(ptd, pev_classname, classname2, sizeof(classname2) - 1);                 if( equali(classname1, "Your classname") && equali(classname2, "Your classname 2") )         {             // your code         }     } }

If you're detecting the ground, the entity will not be vaild.
The entity id will be 0, and there will be no classname for it.


HamSandwich:

Code:
public plugin_init() {     RegisterHam(Ham_Touch, "your classname", "FwdTouch"); } public FwdTouch(entity, client) {     // your code }

danielkza 01-09-2009 19:47

Re: register_touch.. in fakemeta?
 
EDIT: Damn Exo, you're fast.

PHP Code:

public plugin_init()
{
    
register_forward(FM_Touch"OnEntTouch"1)
}

public 
OnEntTouch(entToucherentTouched)
{
    if(
is_user_connected(entToucher))
    {
        static 
szClassname[32]
        
pev(entTouchedszClassnamecharsmax(szClassname))

        if(!
equal(szClassname"func_breakable"))
            return 
FMRES_IGNORED
        
        
// your code goes here
    
}
    return 
FMRES_IGNORED



tuty 01-09-2009 20:08

Re: register_touch.. in fakemeta?
 
ty all :):mrgreen:

anakin_cstrike 01-10-2009 08:33

Re: register_touch.. in fakemeta?
 
Quote:

How to search before posting?!
http://forums.alliedmods.net/showthr...ighlight=touch


All times are GMT -4. The time now is 09:10.

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