Quote:
Originally Posted by RyDeR`
DeleteBadWorld? Anyway. I made a similar function which will work a lot faster and do the same thing:
pawn Code:
stock strdel2(szStr[], ...) { new szArg[128], iStart = 12, iEnd, iLen ; #emit LOAD.S.PRI 8 #emit ADD.C 8 #emit STOR.S.PRI iEnd for( ; iEnd >= iStart; iEnd -= 4, szArg[0] = EOS) { #emit LCTRL 5 #emit LOAD.S.ALT iEnd #emit ADD #emit LOAD.I #emit MOVE.ALT #emit PUSH.ALT #emit PUSH.C 4 #emit SYSREQ.C strlen #emit INC.PRI #emit STOR.S.PRI iLen #emit PUSH.S iLen #emit PUSH.ALT #emit PUSH.ADR szArg #emit PUSH.C 12 #emit SYSREQ.C strcat #emit STACK 24 new iPos ; while((iPos = strfind(szStr, szArg, true, iPos)) != -1) { strdel(szStr, iPos, iPos + iLen); } } return 1; }
Example:
pawn Code:
new str[] = "this is a test to see if this works as expected!"; strdel2(str, "this", "test", "if", "works", "expected", "!"); print(str); // Prints: "is a to see as "
|
OoOps, i make "BadWorld" haha, is "BadWord" xD
I'm don't use Assembly codes in my script's..
i prefeer pawn only xD
Very god job!