Liberty Unleashed

Scripting => Script Help => Topic started by: gamelaster on January 02, 2012, 02:15:38 pm

Title: Dont Remove Head
Post by: gamelaster on January 02, 2012, 02:15:38 pm
Hello, this is code:

function onPlayerCommand( pPlayer, szCmd, szParams )
{
   if( szCmd = "kill" )
   {
      pPlayer.RemoveLimb( BODYPART_HEAD );
      MessagePlayer( "Zabil si sa", pPlayer );
   }
}


What Is bad???
If im type /kill, not send message and dont remove head
Title: Re: Dont Remove Head
Post by: Thijn on January 02, 2012, 04:15:48 pm
You're mixing client scripts with server scripts.

Add this to your client script:
Code: [Select]
pPlayer <- FindLocalPlayer();

function onClientCommand( szCmd, szParams )
{
   if( szCmd == "kill" )
   {
      pPlayer.RemoveLimb( BODYPART_HEAD );
      Message( "Zabil si sa" );
   }
}
Title: Re: Dont Remove Head
Post by: stormeus on January 02, 2012, 07:18:16 pm
Use thijn's code and make it szCmd == "kill", with two equal signs.
Title: Re: Dont Remove Head
Post by: Thijn on January 03, 2012, 02:55:09 pm
Use thijn's code and make it szCmd == "kill", with two equal signs.
ah right, fixed.