Raised This Month: $ Target: $400
 0% 

Solved Custom Fakemeta entity touch not working?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-24-2019 , 17:42   Custom Fakemeta entity touch not working?
Reply With Quote #1

So, I'm spawning my own handmade entity via command and player's aiming end origin and I wanna create specific events on touch. I've been working with ents long time ago, there are great tutorials and threads regarding entities, I thought I've done everything properly, but some diodes in the circuit do not emit the brightest light.

I'm spawning my entity as so:
PHP Code:
public SpawnEnt(Float:fOrigin[3]) {
    
    new 
iEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
    if(!
iEnt) return FMRES_IGNORED;
    
    static const 
Float:fMins[] = {-50.0, -50.0, -50.0};
    static const 
Float:fMaxes[] = {50.050.050.0};
    
    
set_pev(iEntpev_classname"bottle_o_wine");
    
engfunc(EngFunc_SetOriginiEntfOrigin);
    
engfunc(EngFunc_SetModeliEnt"models/winebottle.mdl");
    
set_pev(iEntpev_solidSOLID_TRIGGER);
    
engfunc(EngFunc_SetSizeiEntfMinsfMaxes);
    
dllfunc(DLLFunc_SpawniEnt);
    
    return 
FMRES_IGNORED;

The ent spawns at the exact origin as I wanted. Now here's the touch hooking function and how I've summoned it.

PHP Code:
public FMHookTouch(ptrptd) {
    
    new 
szPlayerClassname[32];
    
pev(ptdpev_classnameszPlayerClassnamecharsmax(szPlayerClassname));
    
    if(!
equal(szPlayerClassname"player"))
        return 
FMRES_IGNORED;
    
    if(!
is_user_alive(ptd) || !is_user_connected(ptd))
        return 
FMRES_IGNORED;
    
    new 
szEntClassname[32];
    
pev(ptrpev_classnameszEntClassnamecharsmax(szEntClassname));
    
    
client_print(ptdprint_chat"Touched: %s"szEntClassname);

PHP Code:
public plugin_init() {
    
    
register_forward(FM_Touch"FMHookTouch");

The function works; func_buyzone, worldspawn and weaponbox (dropped weapon) as a test show up, but my entity does not when I'm going through it. Also, for some reason, SOLID_BBOX does not make my entity solid, I can still go through it (doesn't even trigger the touch). I want it to remain SOLID_TRIGGER, that was only a test, however, could the solidity be an issue? What else might I be doing wrong?

Last edited by redivcram; 12-25-2019 at 08:52.
redivcram is offline
 



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 02:43.


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