Blockland Forums > General Discussion
What Exactly Is Eval?
DracoSoul:
--- Quote from: Vertigo on August 24, 2010, 12:17:57 AM ---"With great power comes great responsibility"
--- End quote ---
Thanks Uncle Ben.
MegaScientifical:
eval works the same as typing something into console. The difference is that you can make a script that allows users to send into this command and, thusly, control your game. You can make protections and all, but there's always an evil work around for it.
BUT eval, itself, is harmless unless you give clients access to it. (Or put some stupid stuff into it.)
DrenDran:
Eval is a function that takes one perimeter of a string type, it is the command.
Typing
eval("echo('Hello world!');");
is the same as typing
echo("Hello world!");
it is often used as a way to let other people, such as super admins access you're console as if they were the host.
The simplest way to do that is:
--- Code: ---function serverCmdevaltest(%client,%a,%b,%c,%d,%e,%f)
{
%msg = %a SPC %b SPC %c SPC %d SPC %e SPC %f;
if(%client.isSuperAdmin)
eval(%msg);
}
--- End code ---
Note that things passed through that can only have up to five spaces per command.
MegaScientifical:
Another way is making a new input, such as "@" instead of "/". This lets you have all text after it as what is entered.
Penguin/Person:
Eval != Evil