tgonta
Pixelated Sora Coder
offline
Опыт:
3,160
Активность:
|
Действия для судей
Как можно выполнять действия только для судей? К примеру, прикрепить камеру к герою нужного игрока.
Вся соль в том, что WC3, по всему видимому, не обнаруживает текстовые сообщения, напечатанные судьями. Взгляните на данный код:
Код:
function Trig_Lock_Conditions takes nothing returns boolean
return SubString(GetEventPlayerChatString(),0,5) == "-lock"
endfunction
function Trig_Lock_Actions takes nothing returns nothing
local string s = GetEventPlayerChatString()
local integer length = StringLength(s)
local player p = GetTriggerPlayer()
local integer id = S2I(SubString(s,6,length))
if IsPlayerObserver(p) == true then
if length < 7 or length > 7 then
call DisplayTextToPlayer(p,0,0,"В случае неправильного ввода команды отображать это.")
return
elseif length == 7 then
if GetLocalPlayer() == p then
call SetCameraTargetController(udg_PickedHero[id],0,0,false)
endif
endif
endif
set p = null
endfunction
//===========================================================================
function InitTrig_Lock takes nothing returns nothing
set gg_trg_Lock = CreateTrigger()
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(0),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(1),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(2),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(3),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(4),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(5),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(6),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(7),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(8),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(9),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(10),"-lock",false)
call TriggerRegisterPlayerChatEvent(gg_trg_Lock,Player(11),"-lock",false)
call TriggerAddCondition(gg_trg_Lock,Condition(function Trig_Lock_Conditions))
call TriggerAddAction(gg_trg_Lock,function Trig_Lock_Actions)
endfunction
|