Raised This Month: $ Target: $400
 0% 

Help With this crash


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-21-2009 , 04:20   Help With this crash
Reply With Quote #1

For some reason it crashes when the target of the healer strafe from left or right

How ever straight back it doesn't crash at all. The code for the healing is below

PHP Code:
public FwdCmdStart(clientuc_handleseed)
{    
    new 
button get_uc(uc_handleUC_Buttons);
    new 
oldbuttons pev(clientpev_oldbuttons);
    static 
targetbody;
    new 
Float:dist get_user_aiming(clienttargetbody);
    static 
FloatTime;
    
Time get_gametime();
    
    if ( !
g_being_healed[client])
    {
        if(
Is_Medic[client] && (button IN_USE) && !(oldbuttons IN_USE) && dist HEALING_DISTANCE )
        {
            if( (
<= target <= g_iMaxPlayers) && is_user_alive(target) && !g_being_healed[target] && !g_healing[target] && Time MEDIC_HEAL_COOLDOWN g_LastHeal[client] && get_user_team(client) == get_user_team(target) )
            {
                
                new 
health get_user_health(target);
                new 
heal_min get_pcvar_num(mhm);
                static 
name[32] ; get_user_name(targetnamecharsmax(name));
                static 
name2[32] ; get_user_name(clientname2charsmax(name2));
                
                if ( 
health heal_min && CanBeHealed[target])
                {
                    
client_print(clientprint_center"Your target: %s"name);
                    
client_print(targetprint_center"You healer: %s"name2);
                    
emit_sound(targetCHAN_ITEMg_medkit_heal1.0ATTN_NORM0PITCH_NORM);
                    
g_healing_teammate[client] = true
                    g_healing
[client] = true;
                    
g_target[client] = target;
                    
                    
g_being_healed[target] = true;
                    
                    
set_task(float(HEAL_TIME), "TaskFinishHeal"client);
                    
_AddProgressclientHEAL_TIME);
                    
_AddProgresstargetHEAL_TIME);
                    
                    
g_LastHeal[client] = Time
                    
                
}
                else if(
health heal_min && CanBeHealed[target])
                {
                    
client_print(clientprint_center"Your target must be below %d health before you can heal them."heal_min);
                }
                if(!
CanBeHealed[target])
                {
                    
client_print(clientprint_center"Your target must first call for you, before you may heal them.");
                }
            }
        }
    }
    else if(
g_healing[client] && !(button IN_USE) && (oldbuttons IN_USE))
    {
        new 
targeti g_target[client];
        
        
g_healing[client] = false;
        
        
g_being_healed[targeti] = false;
        
        
remove_task(client);
        
_AddProgressclientBAR_REMOVE);
        
        
_AddProgresstargetBAR_REMOVE);
    }
    if ( 
g_healing[client] && dist HEALING_DISTANCE )
    {
        new 
targeti g_target[client];
        
        
g_healing[client] = false;
        
        
g_being_healed[targeti] = false;
        
        
remove_task(client);
        
        
_AddProgressclientBAR_REMOVE);
        
        
_AddProgresstargetBAR_REMOVE);
        
    }
    if(
g_healing[client] || g_being_healed[target])
    {
        if ( (
button IN_JUMP) || (button IN_DUCK) || (button IN_FORWARD) || (button IN_BACK) ||
        (
button IN_MOVELEFT) || (button IN_MOVERIGHT) || (button IN_ATTACK) || (button IN_ATTACK2))
        {
            new 
targeti g_target[client];
            
            
g_healing[client] = false;
            
            
g_being_healed[targeti] = false;
            
            
remove_task(client);
            
_AddProgressclientBAR_REMOVE);
            
            
_AddProgresstargetBAR_REMOVE);
        }
    return 
FMRES_IGNORED;

Edit: I believe it has to do with the set_task not being removed....

Dont know how to do that i have tried plenty of things... the last if statment i tried doing it

This is my newest attempt at fixing it.

PHP Code:
if(g_healing[client] || g_being_healed[target])
    {
        if ( (
button IN_JUMP) || (button IN_DUCK) || (button IN_FORWARD) || (button IN_BACK) ||
        (
button IN_MOVELEFT) || (button IN_MOVERIGHT) || (button IN_ATTACK) || (button IN_ATTACK2))
        {
            new 
targeti g_target[client];
            
            
g_healing[client] = false;
            
            
g_being_healed[targeti] = false;
            
            
remove_task(client);
            
_AddProgressclientBAR_REMOVE);
            
            
_AddProgresstargetBAR_REMOVE);
        } 

Last edited by Doc-Holiday; 12-21-2009 at 14:36.
Doc-Holiday 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 04:12.


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