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 enemy, body;
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_Client( enemy ) )
{
set_hudmessage ( 255, 255, 10, -1.0, -0.4, 1, 0.5, 3.0, 0.2, 0.2, 5 );
show_hudmessage ( enemy, "Enemy Ultimate Blocked^n..Entangle Roots.." );
if ( file_exists( "sound/uwc3x/ultimate_stopped.wav" ) == 1 )
{
emit_sound( enemy, CHAN_ITEM, "uwc3x/ultimate_stopped.wav", 1.0, ATTN_NORM, 0, PITCH_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_Client( id ) )
{
if ( file_exists ( "sound/uwc3x/entanglingroots.wav" ) == 1 )
{
emit_sound ( id, CHAN_STATIC, "uwc3x/entanglingroots.wav", 1.0, ATTN_NORM, 0, PITCH_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 + id, cooldownparm, 1 );
}
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.0, ATTN_NORM, 0, PITCH_NORM)
}
--parm[1]
if (parm[1]>0 && get_user_health(id)>0)
{
set_task(0.1, "searchtarget", TASK_ULTIMATE_ENTANGLE_SEARCH+id, parm, 2);
}
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_Client( enemy ) )
{
set_hudmessage ( 255, 255, 10, -1.0, -0.4, 1, 0.5, 3.0, 0.2, 0.2, 5 );
show_hudmessage ( enemy, "Enemy Ultimate Blocked^n..Entangle Roots.." );
if ( file_exists( "sound/uwc3x/ultimate_stopped.wav" ) == 1 )
{
emit_sound( enemy, CHAN_ITEM, "uwc3x/ultimate_stopped.wav", 1.0, ATTN_NORM, 0, PITCH_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+id, parm, 2);
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 + id, cooldownparm, 1 );
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 ( id, origin );
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, 2 );
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_STOP, parm, 6 );
}
return PLUGIN_CONTINUE;
}