Форум

Суббота, 28.06.2025, 23:11 Приветствую Вас Гость
Главная | Регистрация | Вход | RSS
[ Новые сообщения · Участники · Правила форума · Поиск ]
  • Страница 1 из 1
  • 1
Модератор форума: [Try]DiGGeR225  
Выводим часы на HUD
[Try]DiGGeR225Дата: Воскресенье, 05.06.2011, 12:51 | Сообщение # 1
Прибывший
Группа: Администраторы
Сообщений: 501
Награды: 5
Репутация: 4
Статус:
Для этого нам понадобятся стандартные файлы:
config/ui/ui_custom_msgs.xml
scripts/bind_stalker.script

Инструкция:

Сложность: Легко

1. Создаём файл ваше_название_скрипта.script в папке gamedata/scripts и пишем в него:
Code
function show_time()
local hud = get_hud()
local cs = hud:GetCustomStatic("hud_show_time")
if cs == nil then
hud:AddCustomStatic("hud_time_static", true)
hud:AddCustomStatic("hud_show_time", true)
cs = hud:GetCustomStatic("hud_show_time")
end

local time_h = level.get_time_hours()
local time_m = level.get_time_minutes()
local msg
if time_m >= 10 then
msg = string.format(" %02d:%02d\n", time_h, time_m)
else
msg = string.format(" %02d:%02d\n", time_h, time_m)
end

if cs ~= nil then cs:wnd():SetText(msg) end
end

2. Далее открываем файл ui_custom_msgs.xml в config/ui/ и пишем туда:
Code
<hud_time_static x="852" y="17" width="156" height="52">
<text complex_mode="0" x="65" y="0" font="letterica16" r="255" g="255" b="255" a="130">Time</text>
<texture>ui_hud_frame_clock</texture>
</hud_time_static>
<hud_show_time x="862" y="38" width="156" height="52">
<text x="0" y="0" font="graffiti19" r="255" g="255" b="255" a="140" align="c"/>
</hud_show_time>

3. Открываем файл bind_stalker.script и пишем после:
Code
function actor_binder:update(delta)
object_binder.update(self, delta)
local time = time_global()
game_stats.update (delta, self.object)

следущее:
ваше_название_скрипта.show_time()



 
  • Страница 1 из 1
  • 1
Поиск:

Чат доступен только пользователям сайта
Зарегистрироваться

ТОП самых общительных:

[Try]DiGGeR225
Репутация:4
Постов: 501
Файлов: 43
Krendelyok
Репутация:0
Постов: 108
Файлов: 0
Sniper
Репутация:0
Постов: 82
Файлов: 0
Инквизитор
Репутация:0
Постов: 27
Файлов: 0
[K715]
Репутация:0
Постов: 22
Файлов: 0
Конструктор сайтовuCoz