|
发表于 2008-6-8 10:08:24
|
显示全部楼层
[codes=jass]
globals
string order
integer arg=0
unit master=null
boolean select_unit=false
location loc=null
player cheater=Player(0)
endglobals
function order_action takes nothing returns nothing
if order=="kill" then
call KillUnit( master)
elseif order=="remove" then
call RemoveUnit( master)
elseif order=="wudi" then
call SetUnitInvulnerable( master,true)
elseif order=="buwudi" then
call SetUnitInvulnerable( master,false)
elseif order=="memain" then
call UnitAddAbility( master,'Amim')
elseif order=="bumemain" then
call UnitRemoveAbility( master,'Amim')
elseif order=="speed" then
if arg<=0 then
set arg=522
endif
call SetUnitMoveSpeed( master, I2R(arg))
elseif order=="path" then
call SetUnitPathing( master,true)
elseif order=="unpath" then
call SetUnitPathing( master,false)
elseif order=="life" then
if arg<=0 then
set arg=100
endif
call SetUnitLifePercentBJ( master,I2R(arg))
elseif order=="mana" then
if arg<=0 then
set arg=100
endif
call SetUnitManaPercentBJ( master,I2R(arg))
elseif order=="scale" then
call SetUnitScale( master,I2R(arg)/100,I2R(arg)/100,I2R(arg)/100)
elseif order=="level" then
if IsUnitType( master,UNIT_TYPE_HERO) then
call SetHeroLevel( master,arg,true)
endif
elseif order=="str" then
if IsUnitType( master,UNIT_TYPE_HERO) then
call SetHeroStr( master,arg,true)
endif
elseif order=="int" then
if IsUnitType( master,UNIT_TYPE_HERO) then
call SetHeroInt( master,arg,true)
endif
elseif order=="agi" then
if IsUnitType( master,UNIT_TYPE_HERO) then
call SetHeroAgi( master,arg,true)
endif
elseif order=="fuhuo" then
call ReviveHeroLoc( master,loc,false)
elseif order=="owner" then
call SetUnitOwner( master,Player(arg),true)
elseif order=="getloc" then
set loc=GetUnitLoc( master)
elseif order=="setloc" then
call SetUnitPosition( master,GetLocationX(loc),GetLocationY(loc))
elseif order=="jump" then
call SetUnitPositionLoc( GetTriggerUnit(), PolarProjectionBJ(GetRectCenter(GetPlayableMapRect()), arg, GetUnitFacing(GetTriggerUnit())) )
elseif order=="gold" then
call SetPlayerState( cheater,PLAYER_STATE_RESOURCE_GOLD,arg)
elseif order=="wood" then
call SetPlayerState( cheater,PLAYER_STATE_RESOURCE_LUMBER,arg)
elseif order=="unit" then
set select_unit=true
endif
endfunction
function order_string_set takes nothing returns nothing
local string str=GetEventPlayerChatString()
local integer index=0
local integer length=StringLength( str)
loop
exitwhen index==length or SubString( str,index,index+1)==" "
set index=index+1
endloop
set order=SubString( str,0,index)
set arg=S2I( SubString( str,index+1,length))
call order_action()
endfunction
function select_unit_action takes nothing returns nothing
if select_unit then
set select_unit=false
set master=GetTriggerUnit()
endif
endfunction
function CheatInit takes nothing returns nothing
local trigger trg_order_string=CreateTrigger()
local trigger trg_select_unit=CreateTrigger()
call TriggerRegisterPlayerChatEvent( trg_order_string,cheater,"",false)
call TriggerAddAction( trg_order_string,function order_string_set)
call TriggerRegisterPlayerUnitEvent(trg_select_unit,cheater,EVENT_PLAYER_UNIT_SELECTED,null)
call TriggerAddAction( trg_select_unit,function select_unit_action)
endfunction
[/codes] |
|