Blockland Forums > Modification Help
CommandToServer(); causes game to crash
Nexus:
I am trying to create a way so that players are able to use / commands without typing them into the chat.
When they type out the command they want to use (ex: "Self Delete") into a gui, and that is saved as a global variable: $globalvariable
in order for this to accomplish anything, I need to send the command to the server
--- Code: ---commandtoserver($globalvariable);
--- End code ---
as soon as that line is hit, the game crashes with no error code.
I have tried to do things like:
--- Code: ---eval("commandtoserver($globalvariable);");
--- End code ---
but it still crashes.
Is there a way around this? How does blockland convert the string you enter into the chat into a variable so it can be sent as a command to the server?
I played around with this for a bit and I did the following:
--- Code: ---==>commandtoserver('Self Delete');
==>commandtoserver($variable = 'Self Delete');
==>echo($variable);
62
==>commandtoserver(62);
Remote Command Error - command must be a tag.
==>commandtoserver($variable);
--- End code ---
none of these caused me to crash, but then I tried this:
--- Code: ---commandtoserver("Self Delete");
--- End code ---
and the game crashed
So now my question is, how can I convert a variable from a "" string to a '' string? How can I get it so that this:
--- Code: ---$globalvariable = randomgui_textentry.getvalue();
--- End code ---
saves $globalvariable as a '' type string instead of a "" one?
Is the trick using a different kind of gui text box?
Kalphiter:
Because you don't know how to use it
commandToServer('Self Delete');
Nexus:
--- Quote from: Nexus on June 04, 2011, 03:06:21 PM ---
--- Code: ---==>commandtoserver('Self Delete');
--- End code ---
--- End quote ---
--- Quote from: Kalphiter on June 04, 2011, 03:08:38 PM ---tl;dr
--- End quote ---
Deathwish:
Commandtoserver runs a servercmd, do you even know how servercmds work.
Nexus:
--- Quote from: Deathwish on June 04, 2011, 03:41:00 PM ---Commandtoserver runs a servercmd, do you even know how servercmds work.
--- End quote ---
Are people reading my problem? Am I really so vague that you think this applies to what I am talking about?
commandtoserver on the client side will call a servercmd on the server
commandtoclient on the server side will call a clientcmd on the client.
That isn't what I'm having a problem with.
My problem is that commandtoserver(); will crash you if you input a "" string or a variable saved as a "" string. I need to know how to convert a "" string into a '' one, or how to get an input from the client as a '' string through a gui.