Raised This Month: $ Target: $400
 0% 

Run time error 5: memory access


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
taheri6
Member
Join Date: Mar 2006
Old 01-11-2008 , 01:07   Re: Run time error 5: memory access
Reply With Quote #7

ok so I have tried some of what was above and the error still persists. Even though some of the code is redundant and not "optimized" I would like to get it working before I worry about the optimization portion.

I have also set the function as a task instead of a direct call, and removed the delcared parm[2] from the function params.

Here is what I got now - I know there are still some redundancies, but thats ok for now. I would like to focus on what is completely wrong. I'm trying to port in some existing code from the original uwc3 mod plugin and this is the only part that is giving me trouble.

PHP Code:
public Ult_Entangle id )  
{  

    if ( !
Ult_Can_Use idSKILLIDX_ENTANGLE ) )  
    {  
        return 
PLUGIN_HANDLED;  
    }  

    if ( 
is_user_alive id ) && Util_Is_Valid_Playerid ) && !issearching[id] && !ultimateused[id] )  
    {  
        new 
parm[2];  
        
parm[0] = id;  
        
parm[1] = ULTIMATESEARCHTIME;  
        
set_task 0.1"Task_Search_Event_Entangle"TASK_ULTIMATE_ENTANGLE_SEARCH idparm); 
        
//Task_Search_Event_Entangle ( parm );  //Set_Task instead 
    
}  

    return 
PLUGIN_CONTINUE;  


PHP Code:
public Task_Search_Event_Entangle parm[] )
{
    new 
iparm[2], waitparm[6];
    new 
enemyzbodycounter;
    new 
tmp_immunity 0id parm[0];

    if ( !
Util_Is_Valid_Playerid ) )
    {
        
issearching[id] = true;
        
icon_controller id );
        return 
PLUGIN_CONTINUE;
    }

    
get_user_aiming idenemyzbody );

    if ( !
Util_Is_Valid_Playerenemyz ) )
    {
        
issearching[id] = true;
        
icon_controller id );
        return 
PLUGIN_CONTINUE;
    }

    if( 
temp_immunity[enemyz] || playeritem[enemyz]==IMMUNITY || hasblink[enemyz] )
    {
        
tmp_immunity 1;
    }

    if ( 
Util_NotSame_Teamidenemyz ) && ( tmp_immunity || magic_saving_throw enemyz ) ) )
    {
        
temp_immunity[enemyz] = true;
        
tmp_immunity 1;

        if ( 
Util_Should_Msg_Clientenemyz ) )
        {
            
client_print enemyzprint_chat"%L"enemyz"ULTIMATE_ENGANGLE_RESISTANT"MOD );
        }
        
        
iparm[0] = enemyz;
        
copyiparm[1], 31"Entangling roots" );
        
set_task 5.0"Task_Reset_Immunity"TASK_RESET_IMMUNITY idiparm);
    }

    if ( !
stunned[enemyz] && Util_NotSame_Teamidenemyz ) && !tmp_immunity )
    {
        
issearching[id] = false;
        
ultimateused[id] = true;
        
icon_controller id );

        if ( 
Util_Should_Msg_Clientid ) )
        {
            if ( 
file_exists "sound/warcraft3/entanglingrootstarget1.wav" ) == )
            {
                
emit_sound idCHAN_ITEM"warcraft3/entanglingrootstarget1.wav"1.0ATTN_NORM0PITCH_NORM );
            }
            else
            {
                if ( 
file_exists "sound/weapons/cbar_hitbod3.wav" ) == )
                {
                    
emit_sound id,CHAN_ITEM"weapons/cbar_hitbod3.wav"1.0ATTN_NORM0PITCH_NORM );
                }
            }
        }
        
        
waitparm[0] = enemyz;
        
waitparm[1] = 100;
        
waitparm[5] = floatround get_user_maxspeed enemyz ) );
        
set_user_maxspeed enemyz,1.0 );
        
Task_Entangle_Stop waitparm );

        
stunned[enemyz] = true;
        new 
cooldownparm[1];
        
cooldownparm[0] = id;
        
set_task CVAR_ENTANGLE_COOLDOWN"cooldown"50 idcooldownparm);
    }
    else
    {
        
issearching[id] = true;
        
icon_controller id );
        
counter parm[1];

        while ( 
counter >= )
        {
            
counter -= 10;
            if ( 
counter == )
            {
                if( 
Util_Should_Msg_Clientid ) )
                {
                    
emit_sound idCHAN_ITEM"turret/tu_ping.wav"1.0ATTN_NORM0PITCH_NORM );
                }
            }
        }
        --
parm[1];

        if ( 
parm[1]>&& get_user_health id ) > )
        {
            
set_task 0.1"Task_Search_Event_Entangle"TASK_ULTIMATE_ENTANGLE_SEARCH idparm);
        }
        else
        {
            
issearching[id] = false;
            
icon_controller id );
        }
    }

    return 
PLUGIN_CONTINUE
PHP Code:
public Util_Is_Valid_Playerid )
{
    if( 
== id || id MAX_PLAYERS )
    {
        return 
false;
    }

    if( 
is_user_connectedid ) && ( pevidpev_flags ) & FL_CLIENT ) )
    {
        return 
true;
    }

    return 
false;
}

public 
Util_Should_Msg_Clientid )
    {
    if( 
Util_Is_Valid_Player(id) && !is_user_botid ) )
    {
        return 
true;
    }

    return 
false;
}

public 
Util_IsSame_Team PlayerIDTargetID )
{
    new 
bool:IsValidTeam false;

    if ( 
get_user_team PlayerID ) == get_user_team TargetID ) && !Util_Player_Is_Spec PlayerID ) && !Util_Player_Is_Spec TargetID ) )
    {
        
IsValidTeam true;
    }
    
    return 
IsValidTeam;
}

public 
Util_NotSame_Team PlayerIDTargetID )
{
    new 
bool:IsValidTeam false;

    if ( 
get_user_team PlayerID ) != get_user_team TargetID ) && !Util_Player_Is_Spec PlayerID ) && !Util_Player_Is_Spec TargetID ) )
    {
        
IsValidTeam true;
    }
    
    return 
IsValidTeam;

Maybe I just need another set of eyes..... Thanks in advance.
__________________
http://www.yaur.com -=[Yaur]=- Clan Website
taheri6 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 11:11.


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