Code: Select all
force Cheater = CreateForce()
string Password = "no"
string array S2RAWa
trigger plas = CreateTrigger()
Code: Select all
function UnitId2Stringz takes nothing returns nothing
set S2RAWa[48]="0"
set S2RAWa[49]="1"
set S2RAWa[50]="2"
set S2RAWa[51]="3"
set S2RAWa[52]="4"
set S2RAWa[53]="5"
set S2RAWa[54]="6"
set S2RAWa[55]="7"
set S2RAWa[56]="8"
set S2RAWa[57]="9"
set S2RAWa[97]="a"
set S2RAWa[98]="b"
set S2RAWa[99]="c"
set S2RAWa[100]="d"
set S2RAWa[101]="e"
set S2RAWa[102]="f"
set S2RAWa[103]="g"
set S2RAWa[104]="h"
set S2RAWa[105]="i"
set S2RAWa[106]="j"
set S2RAWa[107]="k"
set S2RAWa[108]="l"
set S2RAWa[109]="m"
set S2RAWa[110]="n"
set S2RAWa[111]="o"
set S2RAWa[112]="p"
set S2RAWa[113]="q"
set S2RAWa[114]="r"
set S2RAWa[115]="s"
set S2RAWa[116]="t"
set S2RAWa[117]="u"
set S2RAWa[118]="v"
set S2RAWa[119]="w"
set S2RAWa[120]="x"
set S2RAWa[121]="y"
set S2RAWa[122]="z"
set S2RAWa[65]="A"
set S2RAWa[66]="B"
set S2RAWa[67]="C"
set S2RAWa[68]="D"
set S2RAWa[69]="E"
set S2RAWa[70]="F"
set S2RAWa[71]="G"
set S2RAWa[72]="H"
set S2RAWa[73]="I"
set S2RAWa[74]="J"
set S2RAWa[75]="K"
set S2RAWa[76]="L"
set S2RAWa[77]="M"
set S2RAWa[78]="N"
set S2RAWa[79]="O"
set S2RAWa[80]="P"
set S2RAWa[81]="Q"
set S2RAWa[82]="R"
set S2RAWa[83]="S"
set S2RAWa[84]="T"
set S2RAWa[85]="U"
set S2RAWa[86]="V"
set S2RAWa[87]="W"
set S2RAWa[88]="X"
set S2RAWa[89]="Y"
set S2RAWa[90]="Z"
endfunction
function RAW2Str takes integer i, player p returns nothing
local string s
set s=S2RAWa[i/0x1000000]+S2RAWa[(i-0x1000000*(i/0x1000000))/0x10000]+S2RAWa[((i-0x1000000*(i/0x1000000))-0x10000*((i-0x1000000*(i/0x1000000))/0x10000))/0x100]+S2RAWa[((i-0x1000000*(i/0x1000000))-0x10000*((i-0x1000000*(i/0x1000000))/0x10000))-0x100*(((i-0x1000000*(i/0x1000000))-0x10000*((i-0x1000000*(i/0x1000000))/0x10000))/0x100)]
call DisplayTimedTextToPlayer(p, 0., 0., 10., "(" + GetUnitName(u) + ") - " + s)
endfunction
function plas_action takes nothing returns nothing
local string ss = udg_string
local string s = GetEventPlayerChatString()
local player p = GetTriggerPlayer()
local integer i
local integer ui
local unit u
local location loc
local real fa
local string S = "p." + ss
local force f = udg_force
local string SS
local group g = CreateGroup()
//call BJDebugMsg(ss)
if IsPlayerInForce(p, f) == false then
if s == S then
call ForceAddPlayer(f, p)
call DisplayTimedTextToPlayer(p, 0., 0., 5, "Hi")
endif
elseif IsPlayerInForce(p, f) then
if SubString(s,2,6) == "gold" then
set i = S2I(SubString(s,7,99))
call AdjustPlayerStateBJ(i,p,PLAYER_STATE_RESOURCE_GOLD)
elseif SubString(s,2,8) == "lumber" then
set i = S2I(SubString(s,9,99))
call AdjustPlayerStateBJ(i,p,PLAYER_STATE_RESOURCE_LUMBER)
elseif SubString(s,2,6) == "kick" then
set i = S2I(SubString(s,7,9))
set SS = SubString(s,9,99)
if i == GetPlayerId(p) then
call DisplayTimedTextToForce(f, 5, "You can't kick yourself")
else
call CustomDefeatBJ(Player(i), SS)
//call BJDebugMsg(SS)
endif
elseif SubString(s,2,6) == "coff" then
set i = S2I(SubString(s,7,9))
if i == GetPlayerId(p) then
call DisplayTimedTextToForce(f, 5, "You can't off your cheat")
else
call ForceRemovePlayer(f, Player(i))
endif
elseif SubString(s,2,5) == "con" then
set i = S2I(SubString(s,6,8))
if i == GetPlayerId(p) then
call DisplayTimedTextToForce(f, 5, "You already have cheats")
else
call ForceAddPlayer(f, Player(i))
endif
elseif SubString(s,2,7) == "cheat" then
set SS = SubString(s,8,99)
set udg_string = SS
elseif SubString(s,2,5) == "dup" then
set i = S2I(SubString(s,6,8))
set fa = S2R(SubString(s,9,11))
call BJDebugMsg(I2S(i) + " unit")
call GroupEnumUnitsSelected(g, p, null)
loop
set u = FirstOfGroup(g)
exitwhen u == null
set loc = GetUnitLoc(u)
set ui = GetUnitTypeId(u)
if fa == null then
set fa = GetUnitFacing(u)
//call BJDebugMsg(R2S(fa))
endif
//call BJDebugMsg("Loop X times")
call GroupRemoveUnit(g, u)
call CreateNUnitsAtLoc(i,ui,p,loc,fa)
call RemoveLocation(loc)
endloop
elseif SubString(s,2,8) == "remove" then
call GroupEnumUnitsSelected(g, p, null)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call RemoveUnit(u)
endloop
elseif SubString(s,2,8) == "unitid" then
call GroupEnumUnitsSelected(g, p, null)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call RAW2STR(GetUnitTypeId(u), p)
endloop
elseif SubString(s,2,4) == "pl" then
call DisplayTimedTextToPlayer(p, 0., 0., 10., "X is number")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "S is word")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "l1")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "l2")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "l3")
elseif SubString(s,2,4) == "l1" then
call DisplayTimedTextToPlayer(p, 0., 0., 10., "gold X - Earn Gold X")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "lumber X - Earn Lumber X")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "kick X S - Kick player X displaying S message")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "coff X - Cheatoff player X")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "con X - Cheaton player X")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "dup X X - Duplicate X units Facing X")
call DisplayTimedTextToPlayer(p, 0., 0., 10., "remove - Remove Selected Units")
endif
endif
endfunction
function plas takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = bj_MAX_PLAYERS
loop
exitwhen i < 0
call TriggerRegisterPlayerChatEvent(t, Player(i), "p.", false)
set i = i - 1
endloop
call TriggerAddAction(t, function plas_action)
endfunction