Добавлено (11-12-2010, 15:02) --------------------------------------------- А вот чтобы в мультиплеере работало
Code
function TriggerRegisterAnyPlayerChatEvent takes trigger whichTrigger, string chatMessageToDetect, boolean exactMatchOnly returns nothing local integer i = 0 loop exitwhen i > 11 call TriggerRegisterPlayerChatEvent(whichTrigger,Player(i),chatMessageToDetect,exactMatchOnly) set i = i + 1 endloop endfunction
Code
function Trig_camera_Actions takes nothing returns nothing local integer c=S2I(SubStringBJ(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString()))) local player p=GetTriggerPlayer( ) call SetCameraFieldForPlayer( p , CAMERA_FIELD_TARGET_DISTANCE, c, 0 ) endfunction
//=========================================================================== function InitTrig_camera takes nothing returns nothing set gg_trg_camera = CreateTrigger( ) call TriggerRegisterAnyPlayerChatEvent(gg_trg_camera,"-cam",false) call TriggerAddAction( gg_trg_camera, function Trig_camera_Actions ) endfunction
function TriggerRegisterAnyPlayerChatEvent takes trigger whichTrigger, string chatMessageToDetect, boolean exactMatchOnly returns nothing local integer i = 0 loop exitwhen i > 11 call TriggerRegisterPlayerChatEvent(whichTrigger,Player(i),chatMessageToDetect,exactMatchOnly) set i = i + 1 endloop endfunction
function Trig_camera_Actions takes nothing returns nothing local integer c=S2I(SubStringBJ(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString()))) local player p=GetTriggerPlayer( ) call SetCameraFieldForPlayer( p , CAMERA_FIELD_TARGET_DISTANCE, c, 0 ) endfunction
//=========================================================================== function InitTrig_camera takes nothing returns nothing set gg_trg_camera = CreateTrigger( ) call TriggerRegisterAnyPlayerChatEvent(gg_trg_camera,"-cam",false) call TriggerAddAction( gg_trg_camera, function Trig_camera_Actions ) endfunction
Добавлено (11-12-2010, 16:30) --------------------------------------------- Dreii, кстати незнаешь как сделать чтоб ну пишешь эту -cam и когда колёсиком двигаешь обычно же на норм камеру востанавливает можн сделать чтоб обратно камера возвращалась
function TriggerRegisterAnyPlayerChatEvent takes trigger whichTrigger, string chatMessageToDetect, boolean exactMatchOnly returns nothing local integer i = 0 loop exitwhen i > 11 call TriggerRegisterPlayerChatEvent(whichTrigger,Player(i),chatMessageToDetect,exactMatchOnly) set i = i + 1 endloop endfunction
function CompareChars takes string s, boolean nums, boolean chars, boolean spaces returns boolean local string n = "0123456789" local string lc = "abcdefghijklmnopqrtsuvwxyzабвгдеёжзийклмнопрстуфхцчшщэюяъыь" local string uc = StringCase(lc,true) local string res local integer i = 0 local integer i2 = 0 local integer l local boolean b = false local string array ch
if nums then set res = res + n endif if chars then set res = res + lc + uc endif if spaces then set res = res + " " endif
set l = StringLength(res)
loop exitwhen i > l set ch[i] = SubString(res,i,i + 1) set i = i + 1 endloop
set i = 0 loop exitwhen i > StringLength(s) set b = false set i2 = 0 loop exitwhen i2 > l if SubString(s,i,i + 1) == ch[i2] then set b = true set i2 = l endif set i2 = i2 + 1 endloop if b == false then return b endif set i = i + 1 endloop return true endfunction
function Trig_camera_Actions takes nothing returns nothing local string s = GetEventPlayerChatString() local string c = SubString(s,4,StringLength(s))
if CompareChars(c,true,false,false) then if GetLocalPlayer() == GetTriggerPlayer() then call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,c,0) endif else if GetLocalPlayer() == GetTriggerPlayer() then call ClearTextMessages() call DisplayTimedTextToPlayer(GetLocalPlayer(),.52,-1.,2.,"|cffffcc00ОШИБКА|r. Формат ввода: |cFFA8F272-cam число|r без пробелов после числа.") endif endif endfunction
//=========================================================================== function InitTrig_camera takes nothing returns nothing set gg_trg_camera = CreateTrigger() call TriggerRegisterAnyPlayerChatEvent(gg_trg_camera,"-cam",false) call TriggerAddCondition(gg_trg_camera,Condition(function Trig_camera_Conditions)) call TriggerAddAction(gg_trg_camera,function Trig_camera_Actions) endfunction
if CompareChars(c,true,false,false) then if GetLocalPlayer() == GetTriggerPlayer() then call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,c,0) endif else if GetLocalPlayer() == GetTriggerPlayer() then call ClearTextMessages() call DisplayTimedTextToPlayer(GetLocalPlayer(),.52,-1.,2.,"|cffffcc00ОШИБКА|r. Формат ввода: |cFFA8F272-cam число|r без пробелов после числа.") endif
function TriggerRegisterAnyPlayerChatEvent takes trigger whichTrigger, string chatMessageToDetect, boolean exactMatchOnly returns nothing local integer i = 0 loop exitwhen i > 11 call TriggerRegisterPlayerChatEvent(whichTrigger,Player(i),chatMessageToDetect,exactMatchOnly) set i = i + 1 endloop endfunction
function CompareChars takes string s, boolean nums, boolean chars, boolean spaces returns boolean local string n = "0123456789" local string lc = "abcdefghijklmnopqrtsuvwxyzабвгдеёжзийклмнопрстуфхцчшщэюяъыь" local string uc = StringCase(lc,true) local string res local integer i = 0 local integer i2 = 0 local integer l local boolean b = false local string array ch
if nums then set res = res + n endif if chars then set res = res + lc + uc endif if spaces then set res = res + " " endif
set l = StringLength(res)
loop exitwhen i > l set ch[i] = SubString(res,i,i + 1) set i = i + 1 endloop
set i = 0 loop exitwhen i > StringLength(s) set b = false set i2 = 0 loop exitwhen i2 > l if SubString(s,i,i + 1) == ch[i2] then set b = true set i2 = l endif set i2 = i2 + 1 endloop if b == false then return b endif set i = i + 1 endloop return true endfunction
function Trig_camera_Actions takes nothing returns nothing local string s = GetEventPlayerChatString() local string c = SubString(s,4,StringLength(s))
if CompareChars(c,true,false,false) then if GetLocalPlayer() == GetTriggerPlayer() then call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,c,0) endif else if GetLocalPlayer() == GetTriggerPlayer() then call ClearTextMessages() call DisplayTimedTextToPlayer(GetLocalPlayer(),.52,-1.,2.,"|cffffcc00ОШИБКА|r. Формат ввода: |cFFA8F272-cam число|r без пробелов после числа.") endif endif endfunction
//=========================================================================== function InitTrig_camera takes nothing returns nothing set gg_trg_camera = CreateTrigger() call TriggerRegisterAnyPlayerChatEvent(gg_trg_camera,"-cam",false) call TriggerAddCondition(gg_trg_camera,Condition(function Trig_camera_Conditions)) call TriggerAddAction(gg_trg_camera,function Trig_camera_Actions) endfunction
скажите что и куда надо вставить из кода, а то у меня редактор вырубается когда я это делаю)