| Blockland Forums > Modification Help |
| Chat command / |
| (1/1) |
| austin615:
How would I integrate the chat command / (Ex. /fetch Badspot) Like when an admin says for instance /Killall then it would kill all (Example) |
| CityRPG:
--- Code: ---function serverCmdKillAll(%client) { // Host check if(getNumKey() == %client.bl_id) { // Cycle throguh clent objects. for(%a = 0; %a < ClientGroup.getCount(); %a++) { // Get the player object from that clientgroup object. %player = ClientGroup.getObject(%a).player; // Check if it exists. if(isObject(%player)) { // Kill it. %player.kill(); } } // Message everyone about the abuse of powers. messageAll('', "\c3" @ %client.name @ "\c2 slayed everyone."); } } --- End code --- When a client communicates with the server, it can call special functions called "server commands". It does this through this command: commandToServer('Function_Name', %arguments, %arguments2, %arguments3); Slash commands are read as this: /function_name %arg1 %arg2 %arg3 Saying "/kill Iban" transmutes to this: commandToServer('kill', "Iban"); Which is understood by the server as: function serverCmdKill(%client, %name) Further Reading |
| austin615:
Thank you! :cookie: |
| Navigation |
| Message Index |