Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 12/12/2015
- --Last update: 16/05/2016
- --[[ Notes:
- Does:
- Adiciona uma textarea para checkboxes. Pode-se identificar uma ativa/desativa utilizando ui.checkBoxList[id].
- Args:
- n --> Jogador
- alpha --> Opacidade
- x --> Posição horizontal da textarea
- y --> Posição vertical da textarea
- w --> Largura da textarea
- sets --> As opções (tabela)
- ]]--
- ui.checkBoxList={}
- ui.addCheckBox=coroutine.wrap(function(n,alpha,x,y,w,sets)
- local id = 0
- while true do
- n = n or nil
- alpha = alpha or 1
- x,y,w = x or 300,y or 90,w or 250
- sets = type(sets)=="table" and sets or {"CheckBox"}
- local checkBoxes = #sets
- ui.addTextArea(id + 0,"",n,x,y-1,w,25*checkBoxes+25,0x5D7D90,0x5D7D90,alpha,true)
- ui.addTextArea(id + 1,"",n,x,y+1,w,25*checkBoxes+25,0x11171C,0x11171C,alpha,true)
- ui.addTextArea(id + 2,"",n,x,y,w,25*checkBoxes+25,0x2E424C,0x2E424C,alpha,true)
- id = id + 3
- for i = 1,checkBoxes do
- ui.addTextArea(id + 0,"<font size='30'><G>•",n,x+5,y-11,nil,nil,1,1,0,true)
- ui.addTextArea(id + 1,"<font size='28' color='#12272A'>•",n,x+5,y-10,nil,nil,1,1,0,true)
- ui.addTextArea(id + 2,"<font size='16'><a href='event:checkBox_add_"..tostring(n).."'> </a>",n,x+9,y,nil,nil,1,1,0,true)
- ui.checkBoxList[id+2]=false
- ui.addTextArea(id + 3,sets[i],n,x+25,y+2,nil,nil,1,1,0,true)
- y = y + 25
- id = id + 4
- end
- ui.addTextArea(id + 5,"",n,x+5,y+5,w-10,15,0x5D7D90,0x5D7D90,alpha,true)
- ui.addTextArea(id + 6,"",n,x+5,y+7,w-10,15,0x11171C,0x11171C,alpha,true)
- ui.addTextArea(id + 7,"<p align='center'><a href='event:checkBox_close_"..checkBoxes.."'>Close</a>",n,x+5,y+6,w-10,15,0x3C5064,0x3C5064,alpha,true)
- id = id + 8
- n,alpha,x,y,w,sets = coroutine.yield()
- end
- end)
- eventTextAreaCallback=function(i,n,c)
- local p = {};for val in c:gmatch("[^_]+") do table.insert(p,val) end
- if p[1] == "checkBox" then
- if p[2] == "close" then
- for v = i-(10+p[3]*4),i do
- ui.removeTextArea(v,n)
- end
- elseif p[2] == "add" or p[2] == "rem" then
- local what = 0
- if p[2] == "rem" then what=1 end
- ui.checkBoxList[i] = what==0
- ui.updateTextArea(i,("<font size='%d'><a href='event:checkBox_%s'>%s"):format(what==0 and 13 or 16,what==0 and "rem_"..tostring(p[2]).."_"..i or "add_"..tostring(p[2]),what==0 and "•" or " "),v)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement