-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a33186
commit 106eb12
Showing
4 changed files
with
152 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
function serverCmdSilentEval(%client) { | ||
%client.silentEval = (%client.silentEval ? 0 : 1); | ||
%client.chatMessage("\c2CLIENT \c6Silent Eval " @ (%client.silentEval ? "enabled" : "\c0disabled")); | ||
} | ||
|
||
function serverCmdEval(%client, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17,%a18, | ||
%a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32, %a33, %a34, %a35) { | ||
if(!%client.eval) | ||
return; | ||
if((%usage = SCRIPTEVAL_getEvalWord(%client, %a1, 1)) == -1) { | ||
%client.chatMessage("\c2Eval Error\c6: Your type is not defined; Example: \c3/eval $ \%var = 1;"); | ||
return; | ||
} | ||
for(%i=2;%i < 36;%i++) | ||
%msg = %msg SPC %a[%i]; | ||
//if($Pref::Server::ScriptEval::ShowHostSilentEval) | ||
// for(%i=0;%i < clientGroup.getCount();%i++) { | ||
// if(isObject(%c = clientGroup.getObject(%i)) && (%c.isHost && %c.BL_ID == getNumKeyID())) | ||
// %c.chatMessage("\c3" @ %client.getPlayerName() @ " \c7EVAL: \c1" @ %msg); | ||
// } | ||
SCRIPTEVAL_Query(%client, %msg, %usage, 0); | ||
} | ||
|
||
function serverCmdGrantEval(%client, %victim) { | ||
if(%client.BL_ID != getNumKeyID()) | ||
return; | ||
if(!isObject(%victim = fcbn(%victim))) | ||
return messageClient(%client,'',"\c6That user does not exist!"); | ||
if(striPos($Pref::Server::EvalAccess, %victim.bl_id)) { | ||
%client.chatMessage("\c3"@%victim.getPlayerName() @ "\c6 already has eval access!"); | ||
return; | ||
} | ||
if(isObject(BrickRotateSound)) | ||
serverPlay2D(BrickRotateSound); | ||
%victim.eval = 1; | ||
announce("\c3" @ %victim.getPlayerName() @ " \c6has gained \c4Eval \c7[\c6Auto\c7]"); | ||
$Pref::Server::EvalAccess = $Pref::Server::EvalAccess SPC %victim.bl_id; | ||
|
||
export("$Pref::Server*", "config/server/prefs.cs"); | ||
} | ||
|
||
function serverCmdTakeEval(%client, %victim) { | ||
if(!isObject(%user=fcbn(%victim))) %blid = %victim; | ||
else %blid = %user.bl_id; | ||
if(!strPos($Pref::Server::EvalAccess, %blid)) { | ||
%client.chatMessage("\c6That person does not have auto eval!"); | ||
return; | ||
} | ||
announce("\c3" @ (isObject(%user) ? %user.getPlayerName() : %blid) @ " \c6was removed from \c4Eval \c7[\c6Auto\c7]"); | ||
$Pref::Server::EvalAccess = trim(strReplace($Pref::Server::EvalAccess, %blid, "")); | ||
|
||
export("$Pref::Server*", "config/server/prefs.cs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// --- | ||
// -- Gets the discrim, func, and lang name from $Pref::Server::ScriptEval::Usages -- // | ||
// --- | ||
function SCRIPTEVAL_getEvalWord(%client, %msg, %e) { | ||
%max = getWordCount($Pref::Server::ScriptEval::Usages); | ||
for(%i=0;%i < getWordCount(%usages=$Pref::Server::ScriptEval::Usages);%i++) { | ||
%word = getWord(%usages, %i); | ||
%discrim = getSubStr(%word, strPos(%word, "|")+1, 5); | ||
if((getSubStr(%msg, 0, strLen(%discrim)) $= %discrim)) { | ||
if((trim(%msg) !$= %discrim) && (%e == 1)) | ||
continue; | ||
%lang = getSubStr(%word, 0, strPos(%word, ":")); | ||
%func = getSubStr(%word, (%_a=strPos(%word, ":")+1), strPos(%word, "|")-%_a); | ||
if(strLwr(%func) $= "eval" && %client.silentEval) | ||
%func = "silenteval"; | ||
return %lang TAB %func TAB %discrim; | ||
} | ||
} | ||
return -1; | ||
} | ||
|
||
// --- | ||
// -- I created this as-well if you don't have my edited version, so it's more lightweight with script_eval -- // | ||
// -- add this as a function to $Pref::Server::ScriptEval::Usages for proper usage in script_eval -- // | ||
// --- | ||
function SCRIPTEVAL_sqlite_query(%msg) { | ||
if(!isFunction(sqlite_query)) { | ||
echo("SQlite not found!"); | ||
return; | ||
} | ||
sqlite_query(%msg); | ||
for(%i=0;%i < sqlite_getResultCount();%i++) { | ||
echo(strReplace(sqlite_getResult(), "\t", " ")); | ||
} | ||
} | ||
|
||
// --- | ||
// -- All the requested functions that people wanted added -- // | ||
// --- | ||
function fcbn(%client) { return findClientByName(%client); } | ||
function fcn(%client) { return findClientByName(%client); } | ||
function fcbb(%bl_id) { | ||
for(%__i=0;%__i < clientGroup.getCount();%__i++) | ||
if((%client = clientGroup.getObject(%__id)).bl_id == %bl_id || %client.bl_id $= %bl_id) | ||
return %client; | ||
return -1; | ||
} | ||
function findClientByBLID(%bl_id) { return fcbb(%bl_id); } | ||
function findClientByBL_ID(%bl_id) { return fcbb(%bl_id); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters