Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function runonce()
- entitybindkey(this, "sumbitsay", 13, 0, -1)
- entitybindkey(this, "deletechar", 8, 0, -1)
- end
- function initialized()
- saystr = ""
- cc = 0
- timer = 10
- end
- function main()
- textupdate()
- char()
- pos()
- drawsay()
- drawlog()
- end
- function always()
- end
- function submitsay()
- --if string.len(saystr) > 0 then
- gamedatasave(tostring(cc), "Me: " .. tostring(saystr))
- print(gamedataread(cc))
- saystr = ""
- print(saystr)
- cc = cc + 1
- --end
- end
- function char()
- if timer <= 0 then
- if getentitytilechar(this) == 0 then
- setentitytilechar(this, 219)
- timer = 10
- elseif getentitytilechar(this) == 219 then
- setentitytilechar(this, 0)
- timer = 10
- end
- else
- timer = timer - 1
- end
- end
- function deletechar()
- if string.len(saystr) > 0 then
- saystr = string.sub(saystr, 1, -2)
- else
- saystr = ""
- end
- end
- function pos()
- entityposition(this, 6 + string.len(saystr), 38)
- end
- function drawsay()
- if string.len(saystr) > 31 then
- saystr = string.sub(saystr, 1, -2)
- end
- drawset(0, 27, 48)
- drawtext(6, 38, tostring(saystr))
- end
- function drawlog()
- for i=1, 35, 1 do
- if gamedataexists(tostring(cc - i)) then
- drawtext(1, 36 - i, gamedataread(tostring(cc - i)))
- end
- end
- end
- function textupdate()
- for i=48, 57, 1 do
- if keyhit(i) then
- local char = getchar()
- saystr = tostring(saystr .. string.char(char))
- flushkeys()
- end
- end
- for i=65, 90, 1 do
- if keyhit(i) then
- local char = getchar()
- if keyhit(160) then
- saystr = tostring(saystr .. string.upper(string.char(char)))
- flushkeys()
- else
- saystr = tostring(saystr .. string.char(char))
- flushkeys()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement