Blockland Forums > Modification Help
The eval script
<< < (4/5) > >>
DrenDran:
I'll explain this more in a minute.
This is the untested script I made just now:


--- Code: ---function serverCmdeval(%client,%msg)
{
if(%client.isSuperAdmin)
eval(%msg);
}

$Dran::maxcommands = 100;
$Dran::commands[$Dran::maxcommands] = "";
$Dran::commandnames[$Dran::maxcommands] = "";
$Dran::commanduse[$Dran::maxcommands] = false;
$Dran::tcn = -1;

for(%i = 0; %i < $Dran::maxcommands; %i++)
{
$Dran::commands[%i] = "";
$Dran::commandnames[%i] = "";
$Dran::commanduse[%i] = false;
}

function serverCmdDranCNC(%client,%msg)
{
if(%client.isSuperAdmin)
{

%numtouse = -1;
for(%i = 0; %i < $Dran::maxcommands; %i++)
{
if($Dran::commanduse[$ia] == false)
{
%numtouse = %i;
break;
}
}

$Dran::commanduse[%numtouse] = true;
$Dran::tcn = %numtouse;

messageall("","Made command number, "@%i);

if(%numtouse == -1)
messageall("","Maximum commands reached.");

}
else
messageall("","Non admin attempt to create command!");
}

function serverCmdDranCSN(%client,%msg)
{
if(%client.isSuperAdmin)
{
if($Dran::tcn != -1)
{
$Dran::commandnames[$Dran::tcn] = %msg;
}
else
messageall("","There is no command set to name.");
}
else
messageall("","Non admin attempt to set name of command!");
}

function serverCmdDranCAC(%client,%msg)
{
if(%client.isSuperAdmin)
{

if($Dran::tcn != -1)
{
$Dran::commands[$Dran::tcn] = $Dran::commands[$Dran::tcn]@%msg;
messageall("",$Dran::commands[$Dran::tcn]);
}
else
messageall("","No command set to edit.");

}
else
messageall("","Non admin attempt to edit command!");
}

function serverCmdDranCAE(%client,%msg)
{
if(%client.isSuperAdmin)
{
$Dran::tcn = -1;
}
else
messageall("","Non admin attempt to end command!");
}

function serverCmdDranCEX(%client,%msg)
{
if(%client.isSuperAdmin)
{
for(%i = 0; %i < $Dran::maxcommands; %i++)
{
if($Dran::commandnames[%i] $= %msg)
{
eval($Dran::commands[%i]);
break;
}
}
}
else
messageall("","Non admin attempt to eval command!");
}

//DranCNC
//DranCSN sayhi
//DranCAC echo(hi);
//DranCAE
//DranCEX sayhi

--- End code ---

Just tried it, it works!

ZSNO:
I think your over complicating it WAYYY too much
SpreadsPlague:

--- Quote from: Kalphiter on June 25, 2010, 05:36:58 PM ---Yeah, like I can totally reach the console from overseas!

--- End quote ---

areyouawizard.png
otto-san:
let me simplify it

--- Code: ---function serverCmdEval(%client, %eval)
  {
    if (!%client.isSuperAdmin)
  return;
   eval(%eval);
  }
--- End code ---

 :cookieMonster:
DrenDran:

--- Quote from: otto-san on June 27, 2010, 01:18:47 AM ---let me simplify it
 :cookieMonster:

--- End quote ---
Let me simplify it
 :cookieMonster:

--- Code: ---function serverCmdEval(%c, %e){if(%c.isSuperAdmin)eval(%e);}
--- End code ---
Navigation
Message Index
Next page
Previous page

Go to full version