AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help needed.. (https://forums.alliedmods.net/showthread.php?t=106213)

StormZone 10-12-2009 12:46

Hy again.
Y managed to repair the entangle roots from uwc3x.
Y even added a sound if the ultimate is stoped by the other player blink or necklace of immunity.
Here is the code.
PHP Code:

public searchtarget(parm[2])
{
    new 
id parm[0];
    new 
enemybody;
    
get_user_aiming(id,enemy,body);
    
    if ( (
0<enemy<=32) && (!hasblink[enemy] && playeritem[enemy]!=IMMUNITY) )
    { 
        new 
iparm[2];
        
iparm[0] = enemy;
        
iparm[1] = 1;
    }
    else
    {
        if ( 
Util_Should_Msg_Clientenemy ) )
        {
            
set_hudmessage 25525510, -1.0, -0.410.53.00.20.2);
            
show_hudmessage enemy"Enemy Ultimate Blocked^n..Entangle Roots.." );
            if ( 
file_exists"sound/uwc3x/ultimate_stopped.wav" ) == )
            {
                
emit_soundenemyCHAN_ITEM"uwc3x/ultimate_stopped.wav"1.0ATTN_NORM0PITCH_NORM );
            }    
        }
    }

    if ( 
0<enemy<=32 && !stunned[enemy] && get_user_team(id)!=get_user_team(enemy) && playeritem[enemy]!=IMMUNITY && !hasblink[enemy] && is_user_alive(id) && is_user_alive(enemy) && !temp_immunity[enemy] )
    {
        
issearching[id]=false;
        
ultimateused[id]=true;
        
icon_controller(id);
    
        if ( 
Util_Should_Msg_Clientid ) )
        {
            if ( 
file_exists "sound/uwc3x/entanglingroots.wav" ) == )
            {
                
emit_sound idCHAN_STATIC"uwc3x/entanglingroots.wav"1.0ATTN_NORM0PITCH_NORM );
            }
        }

        new 
waitparm[6];
        
waitparm[0]=enemy;
        
waitparm[1]=100;
        
waitparm[5]=floatround(get_user_maxspeed(enemy));
        
set_user_maxspeed(enemy,1.0);
        
Task_Entangle_Stop(waitparm);

        
stunned[enemy]=true;
        new 
cooldownparm[1];
        
cooldownparm[0]=id;
        
set_task CVAR_ENTANGLE_COOLDOWN"cooldown"50 idcooldownparm);
    }
    else
    {
        
issearching[id]=true;
        
icon_controller(id);
        new 
counter parm[1];
        while (
counter >= 0)
        {
            
counter -= 10;
            if (
counter==0)
            
emit_sound(id,CHAN_ITEM"turret/tu_ping.wav"1.0ATTN_NORM0PITCH_NORM)
        }

        --
parm[1]
        if (
parm[1]>&& get_user_health(id)>0)
        {
            
set_task(0.1"searchtarget"TASK_ULTIMATE_ENTANGLE_SEARCH+idparm2);
        }
        else
        {
            
issearching[id]=false;
            
icon_controller(id);
        }
    }
    return 
PLUGIN_CONTINUE


First y will eplain how this works.
This is and bindable ultimate.ex: bind f "wcentangle"
When y pres the bind button it start searching for and enemy to entangle.
When y aim at the enemy if he isnt protected by blink or necklace of immunity he will get entagled.But if he is he will recive this
PHP Code:

        if ( Util_Should_Msg_Clientenemy ) )
        {
            
set_hudmessage 25525510, -1.0, -0.410.53.00.20.2);
            
show_hudmessage enemy"Enemy Ultimate Blocked^n..Entangle Roots.." );
            if ( 
file_exists"sound/uwc3x/ultimate_stopped.wav" ) == )
            {
                
emit_soundenemyCHAN_ITEM"uwc3x/ultimate_stopped.wav"1.0ATTN_NORM0PITCH_NORM );
            }    
        } 


The problem is that the ultimate for 5 seconds after pressing the bind button it tries to impale the enemy you aim every 0.1 seconds.
PHP Code:

set_task(0.1"searchtarget"TASK_ULTIMATE_ENTANGLE_SEARCH+idparm2); 

How can y do it that if the player(in this case enemy) blocked your entagle to stop searching for an player to entagle him and activate this task
PHP Code:

set_task CVAR_ENTANGLE_COOLDOWN"cooldown"50 idcooldownparm); 

Thanks in advance.

EDIT:

Y fotgot to ad this to.

PHP Code:

public Task_Entangle_Stop parm[6] )
{
    new 
id=parm[0];
    new 
origin[3];
    
get_user_origin idorigin );

    if ( 
origin[0] == parm[2] && origin[1] == parm[3] && origin[2] == parm[4] )
    {
        new 
normalspeed parm[5];
        new 
resetparm[2];
        
resetparm[0] = id;
        
resetparm[1] = normalspeed;
        
set_task float parm[1]/10 ), "reset_maxspeed"TASK_RESET_MAXSPEED id resetparm);

        new 
entangleparm[2];
        
entangleparm[0] = parm[0];
        
entangleparm[1] = parm[1];
        
Event_Entangle entangleparm );
    }
    else
    {
        
parm[2] = origin[0];
        
parm[3] = origin[1];
        
parm[4] = origin[2];
        
set_task 0.1"Task_Entangle_Stop"TASK_ENTANGLE_STOPparm);
    }

    return 
PLUGIN_CONTINUE;



StormZone 10-15-2009 10:27

Re: Help needed..
 
bump.
Come on guyz.
A little help please.

Exolent[jNr] 10-15-2009 11:18

Re: Help needed..
 
Don't bump until 2 weeks have passed since last post.

I've said it to you many times.
Learn the rules before even thinking about posting again:
http://forums.alliedmods.net/showthread.php?t=100352

Locked.


All times are GMT -4. The time now is 22:34.

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