Author Topic: Chatting the Player's Name  (Read 694 times)

I've made a function the whenever a player chats the message /kill they will die. I also want it so when you type it it creates a chat message that the player has died.
It's the last line I believe that's the problem.

Code: [Select]
function kill(%client){
%client = player.getPlayerName();
%client.player.kill();
NewChatSO.addLine("The player"%client"has been killed");
}

messageAll('', %client.getPlayerName() SPC "died");

The first line of the function breaks everything.

For chat commands you use serverCmdYourCommandNameHere

Get rid of this line: %client = player.getPlayerName();


For messaging everyone, you use messageAll('', "Your message here"); - Please note that that the first parameter uses single quotes


For concatenating strings (putting strings together), you use the @ symbol

Example:

messageAll('', "The player " @ %client.name @ " has been killed");

For concatenating AND adding a space you use SPC

Example:

messageAll('', "The player" SPC %client.name SPC "has been killed");
« Last Edit: December 28, 2013, 03:17:49 PM by Electrk. »

« Last Edit: December 29, 2013, 07:31:03 AM by Czar »