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.
// ==============================
// 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;