What's new

Unsolved Need help with a function

X

XeCrash

C++, C# Coder/Support
Messages
690
Reaction score
144
I can't figure out why it wont work when i melee the care package it does nothing. Ive been stuck on this for a couple days. Anyone know how to fix it?
C:
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:
I

ImOx

(^._.^)ノ
Retired
Messages
9,968
Reaction score
2,962
I don't think ismeeleing is a function you want to use, I mean how would it even make sense there?
I think the function you want, is meleebuttonpressed.
Also, how could that if statement ever return true since self.sliding needs to be defined and undefined at the same time. Pretty much impossible?

EDIT: He edited the code he posted, so not everything I said here makes sense anymore.
 
Last edited:
X

XeCrash

C++, C# Coder/Support
Messages
690
Reaction score
144
I don't think ismeeleing is a function you want to use, I mean how would it even make sense there?
I think the function you want, is meleebuttonpressed.
Also, how could that if statement ever return true since self.sliding needs to be defined and undefined at the same time. Pretty much impossible?
ismeleeing(); works im sure of it because i tested it with iprintln("Test"); and i have tried meleebuttonpressed(); as well they both don't let me slide i have tried it with just sliding being undefined as well and it doesn't work either.
 
I

ImOx

(^._.^)ノ
Retired
Messages
9,968
Reaction score
2,962
ismeleeing(); works im sure of it because i tested it with iprintln("Test"); and i have tried meleebuttonpressed(); as well they both don't let me slide i have tried it with just sliding being undefined as well and it doesn't work either.
Yeah, I guess ismeleeing might work just fine, but you obviously need an loop there.
With your current code, you would need to melee at the same time as you trigger the function.
That's most likely is not wanted.
 
X

XeCrash

C++, C# Coder/Support
Messages
690
Reaction score
144
Yeah, I guess ismeleeing might work just fine, but you obviously need an loop there.
With your current code, you would need to melee at the same time as you trigger the function.
That's most likely is not wanted.
Yes i did figure out i was missing a loop now im just trying to get the care package to spawn a little deeper in the ground so i slide off it and i'm good lol
 
Top Bottom