UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Grief Damage on Players?

broken avatar :(
Created 11 years ago
by jbird
0 Members and 1 Guest are viewing this topic.
1,296 views
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 5 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
×
jbird's Groups
I'm trying to make it so if you knife a player they get pushed and if you shoot a player they get slowed down. Here's what I've got so far from jr imagine
Code Snippet
Plaintext
Callback_PlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime )
{
//CODER MOD: TOMMY K, this is to prevent a player killing another player
if( isdefined( eAttacker ) && isPlayer( eAttacker ) && ( !isDefined( level.friendlyexplosivedamage ) || !level.friendlyexplosivedamage ))
{
if( self != eAttacker )
{
//one player shouldn't damage another player, grenades, airstrikes called in by another player
return;
}
else if( sMeansOfDeath != "MOD_GRENADE_SPLASH"
&& sMeansOfDeath != "MOD_GRENADE"
&& sMeansOfDeath != "MOD_EXPLOSIVE"
&& sMeansOfDeath != "MOD_PROJECTILE"
&& sMeansOfDeath != "MOD_PROJECTILE_SPLASH"
&& sMeansOfDeath != "MOD_BURNED" )
{
//player should be able to damage they're selves with grenades and stuff
//otherwise don't damage the player, so like airstrikes  won't kill the player
return;
}
}

if( isDefined( eAttacker ) && isPlayer( eAttacker ) )
{
if( eAttacker meleeButtonPressed() )
{
self setVelocity( vectorToAngles( eAttacker.origin - self.origin ) ); // Not tested, you'll have to play around with this. Most likely won't push the player in the correct direction.

self setMoveSpeedScale( .3 );
wait( 1 );
self setMoveSpeedScale( 1 );
}

if( eAttacker attackButtonPressed() )
{
self setMoveSpeedScale( .3 );
wait( 1 );
self setMoveSpeedScale( 1 );
}
}

// Override MUST call finishPlayerDamage if the damage is to be applied
if( IsDefined( level.overridePlayerDamage ) )
{
self [[level.overridePlayerDamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime );
return;
}

self finishPlayerDamageWrapper( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime );
}

This is the part that was added:
Code Snippet
Plaintext
	if( isDefined( eAttacker ) && isPlayer( eAttacker ) )
{
if( eAttacker meleeButtonPressed() )
{
self setVelocity( vectorToAngles( eAttacker.origin - self.origin ) ); // Not tested, you'll have to play around with this. Most likely won't push the player in the correct direction.

self setMoveSpeedScale( .3 );
wait( 1 );
self setMoveSpeedScale( 1 );
}

if( eAttacker attackButtonPressed() )
{
self setMoveSpeedScale( .3 );
wait( 1 );
self setMoveSpeedScale( 1 );
}
}

Currently, it does absolutely nothing. Doesn't change a thing. Anyone know how to fix it?

 
Loading ...