Answered Need help with a function

Avery Reed

Well-Known Member
Messages
14
Reaction score
2
Points
208
I have been stuck in this for a couple days not to sure what im missing here but when i Melee the care package nothing happens. I would appricate it if some help me figure it out!

Code:
SpawnASlide()
{
    slide = spawn("script_model", self.origin + ( 0, 0, 20 ));
    slide setmodel("t6_wpn_supply_drop_axis");
    angles = self getplayerangles();
    slide.angles = (0, angles[ 1] - 90, 60);
    iprintln("Spawned A ^5Slide");
    foreach(player in level.players)
    {
        player thread monitorslide(slide);
    }

}

monitorslide(model)
{
    self endon("disconnect");
    level endon("game_ended");
    forward = anglestoforward(self getplayerangles());
    if( self ismeleeing() && self getcurrentweapon() == "riotshield_mp" && !IsDefined( self.sliding )  )
    {
        i = 0;
        while(i < 30)
        {
            self.sliding = 1;
            self setvelocity( ( forward[ 0] * 200, forward[ 1] * 200, 999 ) );
            wait 0.05;
            i++;
        }
        self.sliding = undefined;
    }
    wait 0.01;
}
 
Last edited:

TheHiddenHour

Veteran
Messages
57
Reaction score
49
Points
578
I have been stuck in this for a couple days not to sure what im missing here but when i Melee the care package nothing happens. I would appricate it if some help me figure it out!

Code:
SpawnASlide()
{
    slide = spawn("script_model", self.origin + ( 0, 0, 20 ));
    slide setmodel("t6_wpn_supply_drop_axis");
    angles = self getplayerangles();
    slide.angles = (0, angles[ 1] - 90, 60);
    iprintln("Spawned A ^5Slide");
    foreach(player in level.players)
    {
        player thread monitorslide(slide);
    }

}

monitorslide(model)
{
    self endon("disconnect");
    level endon("game_ended");
    forward = anglestoforward(self getplayerangles());
    if( self ismeleeing() && self getcurrentweapon() == "riotshield_mp" && !IsDefined( self.sliding )  )
    {
        i = 0;
        while(i < 30)
        {
            self.sliding = 1;
            self setvelocity( ( forward[ 0] * 200, forward[ 1] * 200, 999 ) );
            wait 0.05;
            i++;
        }
        self.sliding = undefined;
    }
    wait 0.01;
}
Dont forget to have a rioshield
Code:
SpawnASlide()
{
    slide = spawn("script_model", self.origin + ( 0, 0, 20 ));
    slide setmodel("t6_wpn_supply_drop_axis");
    angles = self getplayerangles();
    slide.angles = (0, angles[ 1] - 90, 60);
    iprintln("Spawned A ^5Slide");
    //self giveWeapon("riotshield_mp");
    //self switchToWeapon("riotshield_mp");
    foreach(player in level.players)
        player thread monitorslide(slide);
}

monitorslide(model)
{
    self endon("disconnect");
    level endon("game_ended");
   
    for(;;)
    {
        forward = anglestoforward(self getplayerangles());
        if( self ismeleeing() && self getcurrentweapon() == "riotshield_mp" && !IsDefined( self.sliding )  )
        {
            i = 0;
            while(i < 30)
            {
                self.sliding = 1;
                self setvelocity( ( forward[ 0] * 200, forward[ 1] * 200, 999 ) );
                wait 0.05;
                i++;
            }
            self.sliding = undefined;
        }
        wait .01;
    }
}
 
Top