AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Think Function Isn't Working (https://forums.alliedmods.net/showthread.php?t=129274)

shadow.hk 06-10-2010 21:43

Think Function Isn't Working
 
Hey, I'm wondering what's wrong with this code.

PHP Code:

public thinkDynamite(ent)
{
    static 
id;
    
id entity_get_edict(entEV_ENT_owner);
    
    if( 
g_iPlayerClass[id] != DEMOLITIONS )
    {
        
remove_entity(ent);
        return;
    }
    
    if( !
g_fDynamiteCountdown[id] )
    {
        
ClearSyncHud(idg_msgSyncHudObject_3);
        
        
explode_dynamite(ident);
        return;
    }
    
    
set_hudmessage(255000.350.015.02.00.50.5);
    
ShowSyncHudMsg(idg_msgSyncHudObject_3"%.1f"g_fDynamiteCountdown[id]);
    
    
g_fDynamiteCountdown[id] -= 0.1;
    
entity_set_float(entEV_FL_nextthinkhalflife_time() + 0.1);


When I skip the think function the dynamite explodes fine... so the problem is in here somewhere and I'm not exactly sure what it is. Any help would be greatly appreciated.

wrecked_ 06-10-2010 23:09

Re: Think Function Isn't Working
 
Add some debug messages in. Make client_prints for each possible situation that could be bugged and check to see what isn't valid or isn't being cached correctly.

I'd add some checks in for validity of the entity and its owner first.

shadow.hk 06-11-2010 04:53

Re: Think Function Isn't Working
 
Nevermind, got it. Just a silly mistake somewhere else in the plugin... :|


All times are GMT -4. The time now is 12:57.

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