Blockland Forums > Modification Help
EVAL event
(1/6) > >>
MARBLE MAN:
Here's mah code, plz correct it :P

--- Code: ---registerOutputEvent(GameConnection, "doEval", "string 50 200");

function GameConnection::DoEval(%this,%eval)
{
if(%client.isSuperAdmin)
{
eval(%str);
}
else
{
messageAll('',"\c2" @ %this.name @ "\c3 attempted to DoEVAL");
}
}
--- End code ---

Current Problems:
Doesnt show up in add-ons menu
Doesnt show up in Event Menu
Doesnt allow anyone to use doEval
Munkey:
This is a VERY bad idea, even if it is just for super admins, they still can crash your server. But you did many things wrong with your syntax, here is a fix:


--- Code: ---registerOutputEvent(GameConnection, "doEval", "string 16 140");

function GameConnection::DoEval(%this,%eval)
{
if(%client.isSuperAdmin)
{
%str = getSubStr(%eval);
eval(%str);
}
else
{
messageAll('',"\c2" @ %this.name @ "\c3 tried to use eval through the doEval event");
}
}

--- End code ---

MARBLE MAN:
THANKYOU SO MUCH MUNKEY :D
Destiny/Zack0Wack0:
You can get rid of getSubStr bit, that's not correct nor needed.
Wesley Williams:
So the line:
eval(%str);
Continues the event operation? Sorry, attempting to learn things.
Navigation
Message Index
Next page

Go to full version