//Pacnet2012's Resources //Client - Server Commands //Making a /command that you can type : (Server CMD) function serverCmdName(%client, %type) { //code } //In "serverCmdName" you will replace "Name" to what your command will be called. // function serverCmdSell(%client, %type) will execute code when someone types /sell. //You can replace %type with a variable such as money, amount, or anything. //function serverCmdSell(%client, %thing, %type) for example //We could type /sell Car 500 and your function can use those variables we call arguments. //You can have plenty of arguments, such as //function serverCmdSell(%client, %price, %item, %tax, %bonus) //You must always keep %client the first argument in a serverCmd because if you try making it //something like "%price" and try to say something like "You have to pay [%price]" it will simply spit out the client's object instead, which is bad. You can rename %client to %c or %cl or whatever you want if you use it properly, though! //Here's an example of a command that tells everyone in the server something if you're an admin: function serverCmdSay(%client, %message) { if(%client.isAdmin) { messageAll('','\c6%1 said : %2!', %client.name, %message); } } //COMMUNICATING SERVER TO CLIENT //Let's say you want a client to do something. //You would use : commandToClient(%client, 'function', %vars); //This is assuming that you have the %client object. //On the client side, they would need a script for the function you are sending them. //Example for a client side script : function clientCmdKill(%time) { echo("You'll die in " @ %time @ " seconds! Watch out."); } //Notice how this time on the client side I use "clientCmd" before the function name instead. //To trigger that function from the server, simply do this : commandToClient(%client, 'Kill', 50); //That would print to the client : "You'll die in 50 seconds! Watch out." //Read this carefully a few times to understand it. //You can also communicate with the server. //On the client side script, use this : commandToServer('function', %vars); //Actually, using that is the same as typing /function [vars]! //So you use function serverCmdDunk(%client, %price) { //code } //And use this on the client side : commandToServer('dunk', 50); //================================== //YOU'RE DONE! //That's simply how client - server cmds work. You may now want to read the examples over again to make sure you understand. Best of luck in your scripting affairs! //-Pacnet2012 //==================================