| Blockland Forums > Modification Help |
| Script_ClientKills |
| (1/1) |
| Bauklotz:
Is there some way that I can optimize this? I have a feeling there's something exremely simple right in front of me and I'm missing it. --- Code: ---// ============================== // Support_ClientKills.cs (client-sided) // ============================== // Author: Flaw (BL_ID: 2107) // Project: Scripting Utilities // ============================== // Evaluates a callback every time a kill message is sent to us. // ============================== if($isLoaded["Support_ClientKills"]) return; package clientKills { function clientCmdServerMessage(%callback, %msg, %a, %b, %c, %d, %e, %f, %g, %h, %i, %j, %k, %l, %m, %n) { parent::clientCmdServerMessage(%callback, %msg, %a, %b, %c, %d, %e, %f, %g, %h, %i, %j, %k, %l, %m, %n); if(isMurderMessage(%msg, 8)) onMurderMessage(%a, trim(strReplace(strReplace(%msg, "%2", ""), "%1", "")), %b); else if(isSelf DeleteMessage(%msg, 8)) onSelf DeleteMessage(trim(strReplace(%msg, "%2", "")), %b); } }; activatePackage(clientKills); function isMurderMessage(%message, %bitmapTolerance) { return (strPos(%message, "%1") > -1 && strPos(%message, "<bitmap:") > 2 && strPos(%message, ">") > 11 + %bitmapTolerance && strPos(%message, "%2") > 12 + %bitmapTolerance); } function isSelf DeleteMessage(%message, %bitmapTolerance) { return (strPos(%message, "<bitmap:") > -1 && strPos(%message, ">") > 8 + %bitmapTolerance && strPos(%message, "%2") > 9 + %bitmapTolerance); } function onMurderMessage(%killer, %type, %victim) { } function onSelf DeleteMessage(%type, %victim) { } $isLoaded["Support_ClientKills"] = true; --- End code --- |
| Chrono:
if %callback == 'MsgClientKilled' |
| Bauklotz:
FFFFFFFFFFFFUU- but uh, that callback didn't show up in the list generated by this test: --- Code: ---$f = new fileObject(); $f.openForWrite("config/taggedStrings.txt"); $i = 0; while(strLen($t = getTaggedString($i++)) > 0) $f.writeLine($t); $f.close(); $f.delete(); --- End code --- |
| Chrono:
--- Quote from: Bauklotz on March 19, 2011, 06:39:42 PM ---FFFFFFFFFFFFUU- but uh, that callback didn't show up in the list generated by this test: --- Code: ---$f = new fileObject(); $f.openForWrite("config/taggedStrings.txt"); $i = 0; while(strLen($t = getTaggedString($i++)) > 0) $f.writeLine($t); $f.close(); $f.delete(); --- End code --- --- End quote --- Then it was never called. Self Delete then try again. |
| Navigation |
| Message Index |