Raised This Month: $ Target: $400
 0% 

Problem with Entity Think


Post New Thread Reply   
 
Thread Tools Display Modes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-11-2013 , 15:11   Re: Problem with Entity Think
Reply With Quote #11

Quote:
Originally Posted by darktemplar View Post
Engine doesn't call think while it is attached to another entity.
How you know ? Just noticed it or you read it somewhere ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 15:13   Re: Problem with Entity Think
Reply With Quote #12

Because I print text when entity think. I realize that when player dead, the text is shown
darktemplar is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-11-2013 , 15:20   Re: Problem with Entity Think
Reply With Quote #13

From what i understand in engine, on each server frame, on MOVETYPE_FOLLOW entities, if it's time to think, engine call Think, else, entity origin is set according to aiment origin and angles, so it should work.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 15:25   Re: Problem with Entity Think
Reply With Quote #14

Can you test and show me your code , plz
darktemplar is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-11-2013 , 15:26   Re: Problem with Entity Think
Reply With Quote #15

Test it yourself, when you have time.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 15:31   Re: Problem with Entity Think
Reply With Quote #16

I dont have CS right now. I'm not good at coding
darktemplar is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-11-2013 , 16:22   Re: Problem with Entity Think
Reply With Quote #17

Seems that you mess up classname, sometime you write XBOW, sometimes xbow, and in last code you forgot to set classname at all.
To avoid such errors, use a const variable globale that handles the classname.

PHP Code:
#include < amxmodx >
#include < engine >
#include < fakemeta >
#include < fun >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

new const XBOW_CLASS[] = "XBOW";
new 
g_iszInfoTargetg_iszXbow;

new 
bool:g_bHasXBow[33];

public 
plugin_init()
{
    
register_think(XBOW_CLASS"XBow_Think");
    
g_iszInfoTarget engfunc(EngFunc_AllocString"info_target");
    
g_iszXbow engfunc(EngFunc_AllocStringXBOW_CLASS);
}

public 
create_xbow(id)
{
    if( 
get_user_weapon(id) == CSW_KNIFE )
    {
        if( !
g_bHasXBow[id] )
        {
            new 
ent engfunc(EngFunc_CreateNamedEntityg_iszInfoTarget);
            if( 
ent )
            {
                
g_bHasXBow[id] = true;
                
set_pev_string(entpev_classnameg_iszXbow);
                
entity_set_int(entEV_INT_movetypeMOVETYPE_FOLLOW);
                
entity_set_edict(entEV_ENT_aimentid);
                
entity_set_float(entEV_FL_nextthinkget_gametime() + 2.0);
            }
        }
    }
}

public 
XBow_Thinkent )
{
    new 
id entity_get_edict(entEV_ENT_aiment);
    
g_bHasXBow[id] = false;
    
remove_entity(ent);
    return 
PLUGIN_HANDLED;

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 06:43.


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