| Blockland Forums > Modification Help |
| Need help with input! |
| << < (2/5) > >> |
| I-have-not:
--- Quote from: swollow on January 26, 2012, 06:41:29 PM ---he said "Addon Manual" so I think we can assume that its not the server.cs --- End quote --- Actually, I should've added more, sorry guys. It is a Server command, so yes, it is server.cs. This is how it worx basically: -Host opens console -Host types ServerCmdEnableAddon(<name of add-on here>); -Then the server announces(in Red Text) "Host is enabling <name of add-on here>..."(I know how to do this) -It enables the add-on in the add-on folder, usually the command would be --- Code: ---exec("add-ons/"@%Addon@"/server.cs"); --- End code --- The only real things I don't know how to do in this is 1. Ask for input while typing the command |and| 2. Get the server to announce in red text. If you guys could help me get some info now, that would be greatly appreciated. |
| Swollow:
you only need to type in /EnableAddon you don't need to use the console --- Code: ---function ServerCmdEnableAddon(%Client,%Addon) { //Return; means to exit so were exiting the command //"GetNumKeyID" means the host ID so we are comparing it to the clients id if(%Client.bl_id != getNumKeyID()) return; //This checks if the Server.cs exists if(!isFile("add-ons/"@%Addon@"/server.cs")); return; //This enables the Server.cs exec("add-ons/"@%Addon@"/server.cs"); //This announces it announce("Host is enabling\c3" SPC %Addon); } --- End code --- This code might not work I apologize if it doesn't i wrote it right here in reply |
| I-have-not:
--- Quote from: swollow on January 26, 2012, 09:43:17 PM ---you only need to type in /EnableAddon you don't need to use the console --- Code: ---function ServerCmdEnableAddon(%Client,%Addon) { //Return; means to exit so were exiting the command //"GetNumKeyID" means the host ID so we are comparing it to the clients id if(%Client.bl_id != getNumKeyID()) return; //This checks if the Server.cs exists if(!isFile("add-ons/"@%Addon@"/server.cs")); return; //This enables the Server.cs exec("add-ons/"@%Addon@"/server.cs"); //This announces it announce("Host is enabling\c3" SPC %Addon); } --- End code --- This code might not work I apologize if it doesn't i wrote it right here in reply --- End quote --- Yeah, it actually didn't work. See if you can find a way to debug it, because it has a Syntax error in input. Thanks for submitting it though, it gave me a bit of an idea. But still, it doesn't define the variable %Addon! How should I define it? Or is it @ that asks for input from the player? And if so, why are there 2 @s? ?:/ |
| Swollow:
--- Quote from: I-have-not on January 26, 2012, 10:05:20 PM ---Yeah, it actually didn't work. See if you can find a way to debug it, because it has a Syntax error in input. Thanks for submitting it though, it gave me a bit of an idea. But still, it doesn't define the variables %Client or %Addon! How should I define them? --- End quote --- uh ya it does %Client and %Addon are defined in the function (in green below) the first argument in a server command is always the client who typed it any arguments after that are for inputs Example: function ServerCmdEat(%client,%food,%amount) { messageClient(%client.name SPC "Ate" SPC %amount SPC "of" SPC %food); } %client is who typed it %food is the first input %amount is the second input Typing /Eat bananas 4 would display Your Name Ate 4 bananas probably fixed code: function ServerCmdEnableAddon(%Client,%Addon) { //Return; means to exit so were exiting the command //"GetNumKeyID" means the host ID so we are comparing it to the clients id if(%Client.bl_id != getNumKeyID();) return; //This checks if the Server.cs exists if(!isFile("add-ons/"@%Addon@"/server.cs")); return; //This enables the Server.cs exec("add-ons/"@%Addon@"/server.cs"); //This announces it announce("Host is enabling\c3" SPC %Addon); } |
| I-have-not:
--- Quote ---probably fixed code: function ServerCmdEnableAddon(%Client,%Addon) { //Return; means to exit so were exiting the command //"GetNumKeyID" means the host ID so we are comparing it to the clients id if(%Client.bl_id != getNumKeyID();) return; //This checks if the Server.cs exists if(!isFile("add-ons/"@%Addon@"/server.cs")); return; //This enables the Server.cs exec("add-ons/"@%Addon@"/server.cs"); //This announces it announce("Host is enabling\c3" SPC %Addon); } --- End quote --- U were right! Still isn't fixed. Try some more, I really want this code! Perhaps there is supposed to be a semicolon here! --- Code: ---if(!isFile("add-ons/"@%Addon@"/server.cs")<SEMICOLON HERE>); --- End code --- |
| Navigation |
| Message Index |
| Next page |
| Previous page |