Author Topic: Basic / command  (Read 676 times)

How would I go about making a basic / command that responds by saying something in the chat?
I just want a simple answer, prefferably the script so I can look at it and make it fit my own needs.

Also: How do I check the health of a player to use in a script?

« Last Edit: August 20, 2008, 06:59:42 PM by blaman »

// starts a comment, so you should be able to figure it out with the comments added on.

Code: [Select]
function serverCmdShowMessage(%client) //function starts a function, serverCmd makes it a /command
//showMessage makes it /showMessage, and %client is the variable you need for serverCmds
{ //open the function's code block
  messageAll('',"Hello world"); //messageAll sends a chat message, '' is the message type (don't change it),
//and "Hello world" is the actual message.
} //end the function

And if you can't read the actual script with all the comments...

Code: [Select]
function serverCmdShowMessage(%client)
{
  messageAll('',"Hello world");
}

Small note, the blank quote in the message all is actually two single quotes (two of '), not one "

lol, I know how to read the comments. And thank you. :D  Also, There still stands my other question. If someone would like to answer it.
« Last Edit: August 21, 2008, 01:22:43 AM by blaman »

If I remember correctly (and I'm not sure if I do) it's %client.player.getDamageLevel().
I could be wrong, and I'm far too lazy to test it, so tell me if it works. :D

Either getDamageLevel() [Real amount of health lost] or getDamagePercent() [0-1, 1=dead]. Remember that these get the amount of damage you have taken, not remaining health. Do (player.getDatablock().maxDamage - player.getDamageLevel()) for remaining health.