Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ui_msgbox_time = 8000
- local ui_msgbox_max = 5
- local ui_msgbox_x,ui_msgbox_y,ui_msgbox_w,ui_msgbox_h,ui_msgbox_dy = 100,50,600,20,35
- local ui_msgbox_c,ui_msgbox_bc,ui_msgbox_da = nil,nil,0.2
- local ui_msgbox_messages = {}
- function showMsg(msg, tgt)
- local box,j
- if ui_msgbox_messages[ui_msgbox_max] then ui_msgbox_messages[ui_msgbox_max] = nil end
- for i=#ui_msgbox_messages+1,1,-1 do
- if i==1 then
- ui_msgbox_messages[i] = {msg=msg, ts=os.time()}
- else
- ui_msgbox_messages[i] = ui_msgbox_messages[i-1]
- end
- j = i - 1
- ui.addTextArea(i, ui_msgbox_messages[i].msg, tgt, ui_msgbox_x, ui_msgbox_y + j*ui_msgbox_dy, ui_msgbox_w, ui_msgbox_h, ui_msgbox_c, ui_msgbox_bc, 1 - j*ui_msgbox_da, true)
- end
- end
- function eventLoop(t,tr)
- for i=1,ui_msgbox_max do
- local m = ui_msgbox_messages[i]
- if m and m.ts + ui_msgbox_time < os.time() then
- ui_msgbox_messages[i] = nil
- ui.removeTextArea(i, nil)
- end
- end
- end
- function eventChatCommand(name, com)
- if com:sub(1,3) == "msg" then
- showMsg("<V>["..name.."]<N> "..com:sub(5,60))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement