Answered need help with these two codws

arbus94

New Member
Messages
17
Points
3
hello everyone,

i have a problem with these two codes, there arent bad syntax in it but they doesnt work and idk why.. i hope someone can help me out

thanks in advance.

//slide code
initslide()
{
self thread processslide();
}

processslide()
{
self endon("slide_restore");
slidepos = self.origin;
slidee = spawn("script_model", self.origin + (0, 0, 10));
slidee setmodel("t6_wpn_supply_drop_ally");
slidee.angles = self.angles + (30, 0, 90);
while (self meleebuttonpressed() && distance(self.origin, slidee.origin) <= 100)
{
self.originobj = spawn("script_origin", self.origin, 1);
self.originobj.angles = self.angles;
self playerlinkto(self.originobj, undefined);
wait 0.1;
sweapon = self getcurrentweapon();
normalized = anglesToForward(self getplayerangles());
scaled = vectorScale(normalized, 200);
originpos = self.origin + scaled;
self.originobj.origin = originpos;
self unlink();
i = 0;
while (i < 10)
{
self setvelocity(self getvelocity() + (0, 0, 340));
wait 0.05;
i++;
}
}
wait 0.05;
wait 0.05;
}


// carepackagestall code
carepackagestall()
{
stallpos = self.origin;
stall = spawn("script_model", self.origin + (0, 0, 10));
stall setmodel("t6_wpn_supply_drop_ally");
stall.angles = (0, 0, 0);
if(self usebuttonpressed() && distance(self.origin, stall.origin) <= 100)
{
self.stallin = spawn("script_model", self.origin);
self playerlinkto(self.stallin);
self iprintlnbold("capturing...");
self disableweapons();
}
else
{
if (distance(self.origin, stall.origin) <= 100 && self.menustate == 0)
{
self unlink();
self enableweapons();
}
}
wait 0.001;
wait 0.001;
}
 

DrifterTheHomie

New Member
Messages
6
Points
3
This is my edited slide code:

Put this in onPlayerSpawned()
Code:
level.slideWith = "Only With Riotshield";
Call it like:
Code:
"Spawn Slide @ Crosshair", ::slideAtCrosshair);
"Change Slide Usable Type", ::usableWith);
This in your menu functions:
Code:
usableWith()
{
    if ( level.slideWith == "Only With Riotshield" )
        level.slideWith = "With Out Riotshield";
    else
        level.slideWith = "Only With Riotshield";
   
    iPrintln("Slide Can Be Used Now: ^3" + level.slideWith);
}

slideAtCrosshair()
{
    iPrintLn("Slide Spawned At: ^3" + self.name + " ^7Position!");
    self thread makeTheSlide( bullettrace( self gettagorigin( "j_head" ), self gettagorigin( "j_head" ) + anglesToForward( self getplayerangles() ) * 1000000, 0, self ) [ "position" ] + ( 0, 0, 20 ), self getPlayerAngles() );
}

makeTheSlide( slidePos, direction )
{
    self endon( "disconnect" );
    level endon( "game_ended" );
   
    playngles1 = self getPlayerAngles();
    playnglesVV = anglesToForward( playngles1 );

    CP = spawn( "script_model" , slidePos );
    CP.angles=( 0 , playngles1[1] - 90, 60 );
    CP setModel( "t6_wpn_supply_drop_axis" );

    CP2 = spawn( "script_model", slidePos + ( 60 * playnglesVV[0], 60 * playnglesVV[1], 0 ) );
    CP2.angles = ( 0, playngles1[1] - 90, 70 );
    CP2 setModel( "dest_zm_nuked_female_01_d0" );
   
    for (;;)
    {
        foreach ( player in level.players )
        {
            if ( level.slideWith == "Only With Rioshield" )
            {
                if ( player isInPos2( slidePos ) && player meleeButtonPressed() && isSubStr( player getCurrentWeapon(), "riotshield_mp") && length( vecXY( player getPlayerAngles() - direction) ) < 15 )
                {
                    player setOrigin( player getOrigin() + ( 0, 0, 10 ) );
                    playngles22 = anglesToForward( player getPlayerAngles() );
                    x = 0;
                    player setVelocity( player getVelocity() + ( playngles22[0] * 1000 , playngles22[1] * 1000, 0 ) );
                    while( x < 15)
                    {
                        player setVelocity( self getVelocity() + ( 0 , 0 , 999 ) );
                        x++;
                        wait 0.01;
                    }
                    wait 0.5;
                }
            }
            else if ( level.slideWith == "With Out Riotshield" )
            {
                if ( player isInPos2( slidePos ) && player meleeButtonPressed() && length( vecXY( player getPlayerAngles() - direction) ) < 15 )
                {
                    player setOrigin( player getOrigin() + ( 0, 0, 10 ) );
                    playngles22 = anglesToForward( player getPlayerAngles() );
                    x = 0;
                    player setVelocity( player getVelocity() + ( playngles22[0] * 1000 , playngles22[1] * 1000, 0 ) );
                    while( x < 15)
                    {
                        player setVelocity( self getVelocity() + ( 0 , 0 , 999 ) );
                        x++;
                        wait 0.01;
                    }
                    wait 0.5;
                }
            }
        }
        wait 0.10;
    }
}

isInPos2( sP2 )
{
    if ( distance( self.origin, sP2 ) < 100 )
        return true;
    else
        return false;
}

vecXY( vec )
{
    return ( vec[0], vec[1], 0 );
}
 

arbus94

New Member
Messages
17
Points
3
This is my edited slide code:

Put this in onPlayerSpawned()
Code:
level.slideWith = "Only With Riotshield";
Call it like:
Code:
"Spawn Slide @ Crosshair", ::slideAtCrosshair);
"Change Slide Usable Type", ::usableWith);
This in your menu functions:
Code:
usableWith()
{
    if ( level.slideWith == "Only With Riotshield" )
        level.slideWith = "With Out Riotshield";
    else
        level.slideWith = "Only With Riotshield";
  
    iPrintln("Slide Can Be Used Now: ^3" + level.slideWith);
}

slideAtCrosshair()
{
    iPrintLn("Slide Spawned At: ^3" + self.name + " ^7Position!");
    self thread makeTheSlide( bullettrace( self gettagorigin( "j_head" ), self gettagorigin( "j_head" ) + anglesToForward( self getplayerangles() ) * 1000000, 0, self ) [ "position" ] + ( 0, 0, 20 ), self getPlayerAngles() );
}

makeTheSlide( slidePos, direction )
{
    self endon( "disconnect" );
    level endon( "game_ended" );
  
    playngles1 = self getPlayerAngles();
    playnglesVV = anglesToForward( playngles1 );

    CP = spawn( "script_model" , slidePos );
    CP.angles=( 0 , playngles1[1] - 90, 60 );
    CP setModel( "t6_wpn_supply_drop_axis" );

    CP2 = spawn( "script_model", slidePos + ( 60 * playnglesVV[0], 60 * playnglesVV[1], 0 ) );
    CP2.angles = ( 0, playngles1[1] - 90, 70 );
    CP2 setModel( "dest_zm_nuked_female_01_d0" );
  
    for (;;)
    {
        foreach ( player in level.players )
        {
            if ( level.slideWith == "Only With Rioshield" )
            {
                if ( player isInPos2( slidePos ) && player meleeButtonPressed() && isSubStr( player getCurrentWeapon(), "riotshield_mp") && length( vecXY( player getPlayerAngles() - direction) ) < 15 )
                {
                    player setOrigin( player getOrigin() + ( 0, 0, 10 ) );
                    playngles22 = anglesToForward( player getPlayerAngles() );
                    x = 0;
                    player setVelocity( player getVelocity() + ( playngles22[0] * 1000 , playngles22[1] * 1000, 0 ) );
                    while( x < 15)
                    {
                        player setVelocity( self getVelocity() + ( 0 , 0 , 999 ) );
                        x++;
                        wait 0.01;
                    }
                    wait 0.5;
                }
            }
            else if ( level.slideWith == "With Out Riotshield" )
            {
                if ( player isInPos2( slidePos ) && player meleeButtonPressed() && length( vecXY( player getPlayerAngles() - direction) ) < 15 )
                {
                    player setOrigin( player getOrigin() + ( 0, 0, 10 ) );
                    playngles22 = anglesToForward( player getPlayerAngles() );
                    x = 0;
                    player setVelocity( player getVelocity() + ( playngles22[0] * 1000 , playngles22[1] * 1000, 0 ) );
                    while( x < 15)
                    {
                        player setVelocity( self getVelocity() + ( 0 , 0 , 999 ) );
                        x++;
                        wait 0.01;
                    }
                    wait 0.5;
                }
            }
        }
        wait 0.10;
    }
}

isInPos2( sP2 )
{
    if ( distance( self.origin, sP2 ) < 100 )
        return true;
    else
        return false;
}

vecXY( vec )
{
    return ( vec[0], vec[1], 0 );
}
the slidecode from you crashes my game :/
 

Similar threads


Top