Liberty Unleashed

Scripting => Scripting Discussion => Topic started by: Raiden on January 04, 2012, 10:57:27 pm

Title: Explosion
Post by: Raiden on January 04, 2012, 10:57:27 pm
Code: [Select]
if ( cmd == "explosion" )
     {
          local pos = player.Pos;
          pos.x += 5.0;
         
          CreateExplosion( pos, 1 );
     }

Code: [Select]
g_LocalPlayer <- FindLocalPlayer();

function onClientShot( pPlayer, iWeapon, iBodypart )
{
if ( g_LocalPlayer.Immune == false )
         {
if ( iWeapon == WEP_EXPLOSION )
{
   
g_LocalPlayer.RemoveLimb( BODYPART_LEFTARM )
ShakeCamera( pPlayer, 30000 );
         
}
         }
    return 1;
}

Wonder why wen I blowup a car ingame my arm falls, and wen I use /explosion wen the it explodes near me nothing happens even wen my player gets hit by it.
Tried with different types of explosion and still no shit.
How is that possible wen the car blows up its an EXPLOSION and my player's arm falls. And wen I simulate an EXPLOSION with the cmd nothing happens.


Any IDEAS?
Title: Re: Explosion
Post by: Raiden on January 04, 2012, 11:13:23 pm
http://liberty-unleashed.co.uk/LUWiki/Squirrel/Server/Functions#Camera_Functions (http://liberty-unleashed.co.uk/LUWiki/Squirrel/Server/Functions#Camera_Functions)

Nope its not only for VC.
-----------------------
But thats the script for the explosion to kill the player & to remove all his limbs.
Im trying to make the /explosion cmd to be able to remove the player limbs, not only wen i blowup a car and Im near it.
Title: Re: Explosion
Post by: Vortrex on January 05, 2012, 12:49:45 am
I think it would be freakin epic to see a torso limb being removed, so its just arms and legs and a head moving around (hehehe)
Title: Re: Explosion
Post by: stormeus on January 05, 2012, 12:13:01 pm
Scripted explosions (CreateExplosion) do not have a player associated with them. Either pPlayer is null or you're looking for onClientHurt.

Code: [Select]
ShakeCamera( pPlayer, 30000 );

Is this supposed to be for the local player, the player shooting, or both?

You could also try wrapping the entire thing in a try/catch block.
Code: [Select]
function onClientShot( pPlayer, iWeapon, iBodypart )
{
    try
    {
if ( g_LocalPlayer.Immune == false )
         {
if ( iWeapon == WEP_EXPLOSION )
{
   
g_LocalPlayer.RemoveLimb( BODYPART_LEFTARM )
ShakeCamera( pPlayer, 30000 );
         
}
         }
    }
    catch( e ) { Message( e ); }

    return 1;
}
Title: Re: Explosion
Post by: Raiden on January 05, 2012, 11:44:51 pm
Code: [Select]
ShakeCamera( pPlayer, 30000 );

Is this supposed to be for the local player, the player shooting, or both?

Never mind that, I was experimenting with it.

Oh and the try/catch block dint work, or i failed with it.

Gonna try with the OnClientHurt.