Jump to content

Hex Color Help


1LoL1

Recommended Posts

Please someone help me how do I put this script all hexes away if one would please all client code

-- Client

--- DONT TRY TO COPY LITTLE BITCH 
 
g_LocalPlayer = getLocalPlayer()
g_Root = getRootElement()
g_ThisResource = getThisResource()
g_ResourceRoot = getResourceRootElement(getThisResource())
 
chat = {} -- table to store chat windows in
newmsg = {show=false, tick=getTickCount(), showtime=5000, img=nil, lbl=nil } -- new msg table
 
 
anims = {}
 
function buildPlayerList()
    local x,y = guiGetScreenSize()
    local width,height = 175,350
    x = x-width
    y = (y-height)/2
    newmsg.img = guiCreateStaticImage(681.0000,134.0000, 42.0000,34.0000, "image/chat-icon.png", false) -- mail message icon
    newmsg.lbl = guiCreateLabel(553.0000,175.0000, 244.0000, 19.0000, "", false)
        guiLabelSetHorizontalAlign(newmsg.lbl, "right", true)
    guiSetAlpha(newmsg.img, 0)
    --guiSetAlpha(newmsg.lbl, 0)
   
    wndPlayers = guiCreateWindow(x,y,width,height, "Private Chat", false)
    grdPlayers = guiCreateGridList(.025,.065, .975,.915, true, wndPlayers)
        colPlayers = guiGridListAddColumn(grdPlayers, "Players", 0.85)
 
    local players = getElementsByType("player")
    for k,v in ipairs(players) do
        addPlayerToList(v)
    end
   
    guiWindowSetSizable(wndPlayers, false)
    guiSetProperty(wndPlayers, "RollUpEnabled", "true")
    guiSetProperty(wndPlayers, "Dragable", "true")
    guiSetAlpha(wndPlayers, 0)
   
   
    -- create animations for it
    anims.plfadein = Animation.create(wndPlayers, Animation.presets.guiFadeIn(1000))
    anims.plfadeout = Animation.create(wndPlayers, Animation.presets.guiFadeOut(1000))
 
    anims.nmfadein = Animation.create(newmsg.img, Animation.presets.guiFadeIn(1000))
    anims.nmfadeout = Animation.create(newmsg.img, Animation.presets.guiFadeOut(1000))
   
    anims.nmtextin = Animation.create(newmsg.lbl, Animation.presets.guiFadeIn(1000))
    anims.nmtextout = Animation.create(newmsg.lbl, Animation.presets.guiFadeOut(1000))
   
--[[    local x,y = guiGetPosition(newmsg.img)
    outputDebugString("guigetPostions: " ..tostring(x).." "..tostring(y))
    local scrx,scry = guiGetScreenSize()
    anims.nmslidein = Animation.create(newmsg.img, Animation.presets.guiMove(x,y))--, 1000,false, scrx,scry, false))
    anims.nmslideout = Animation.create(newmsg.img, Animation.presets.guiMove(scrx,scry))--, 1000,false, x,y, false))
]] 
    bindKey("F2", "down", togglePmGui) 
end
function addPlayerToList(ply)
    --outputDebugString("addPlayerToList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local row = guiGridListAddRow(grdPlayers)
    local name = getPlayerName(ply)
    guiGridListSetItemText(grdPlayers,row,colPlayers, name, false, false)
end
function removePlayerFromList(ply)
    --outputDebugString("removePlayerFromList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local name=getPlayerName(ply)
    for row=0,guiGridListGetRowCount(grdPlayers) do
        if guiGridListGetItemText(grdPlayers, row, colPlayers) == name then
            guiGridListRemoveRow(grdPlayers, row)
            outputDebugString("remove row" ..tostring(row))
        end
    end
end
 
 
function showPmGui(state)
    if state == true then
        anims.plfadein:play()
        for k,v in pairs(chat) do
            guiSetVisible(chat[k].wnd,true)
        end
        showCursor(true)
    elseif state == false then
        anims.plfadeout:play()
        for k,v in pairs(chat) do   
            guiSetVisible(chat[k].wnd,false)
        end
        showCursor(false)
        guiSetInputEnabled(false)
    end
end
function togglePmGui()
    if not anims.plfadein:isPlaying() and not anims.plfadeout:isPlaying() then
        if guiGetAlpha(wndPlayers) > .1 then showPmGui(false)
        else showPmGui(true)
        end
    end
end
 
function buildChatWindow(ply)
    local x,y = guiGetScreenSize()
    local width,height = 300,250
    x = x*.5
    y = y*.5
   
    chat[ply] = {}
    chat[ply].wnd = guiCreateWindow(x,y,width,height, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") , false)
    chat[ply].memo = guiCreateMemo(.025,.075, .95,.55, "", true, chat[ply].wnd)
    chat[ply].edit = guiCreateEdit(.025,.65, .95,.15, "", true, chat[ply].wnd)
    chat[ply].btnClose = guiCreateButton(.1,.83, .3,.125, "Close", true, chat[ply].wnd)
    chat[ply].btnSend = guiCreateButton(.6,.83, .3,.125, "Send", true, chat[ply].wnd)
   
    guiMemoSetReadOnly(chat[ply].memo, true)
   
    guiWindowSetSizable(chat[ply].wnd, false)
    guiSetProperty(chat[ply].wnd, "RollUpEnabled", "true")
    guiSetProperty(chat[ply].wnd, "Dragable", "true")
   
    if anims.plfadein:isPlaying() then-- in process of fading in
        guiSetVisible(chat[ply].wnd, true)
    elseif anims.plfadeout:isPlaying() then -- in process of fading out
        guiSetVisible(chat[ply].wnd, false)
    else -- not in process of either
        if guiGetAlpha(wndPlayers) > .1 then
            guiSetVisible(chat[ply].wnd, true) -- is showing
        else
            guiSetVisible(chat[ply].wnd, false) -- isnt showing
        end 
    end
end
function destroyChatWindow(ply)
    if chat[ply] and isElement(chat[ply].wnd) then
        destroyElement(chat[ply].wnd)
        chat[ply] = nil 
    end
end
 
function sendChatMessage(ply)
    --outputDebugString("sendChatMessage: " .. tostring(ply))
    if chat[ply] and isElement(chat[ply].wnd) then
        local newText = guiGetText(chat[ply].edit)
        if newText and string.len(newText) > 0 then
            local oldText = guiGetText(chat[ply].memo)
            if not oldText then oldText = "" end
            oldText = oldText .. getPlayerName(g_LocalPlayer):gsub("#%x%x%x%x%x%x","") .. ": " .. newText .. "\n"
            guiSetText(chat[ply].memo, oldText)
            guiSetText(chat[ply].edit, "")
            guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
 
            triggerServerEvent("onGUIPrivateMessage", g_LocalPlayer, ply,newText)
        end 
    end
end
function recieveChatMessage(ply, msg)
    --outputDebugString("recieveChatMessage: " .. msg)
    if not chat[ply] then
        buildChatWindow(ply)
    end
   
    newmsg.show = true
    newmsg.tick = getTickCount()
   
    ---guiSetText(newmsg.lbl, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n")
guiSetText(newmsg.lbl, "New Messages " .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. "\n")
    anims.nmfadein:play()
    anims.nmtextin:play()
    --anims.nmslidein:play()
 
    local oldText = guiGetText(chat[ply].memo)
    if not oldText then oldText = "" end
    oldText = oldText .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n"
    guiSetText(chat[ply].memo, oldText)
    guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
end
 
event_resource_start = function(res)
    buildPlayerList()
    outputChatBox("",255,255,255,true)
end
 
event_resource_stop = function(res)
    unbindKey("F2", "down", togglePmGui)   
    showPmGui(false)
end
 
event_player_join = function()
    --outputDebugString("onClientPlayerJoin")
    addPlayerToList(source)
end
 
event_player_quit = function()
    --outputDebugString("onClientPlayerQuit")
    removePlayerFromList(source)
    destroyChatWindow(source)
end
 
event_gui_click = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if getElementType(source) == "gui-button" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if ply then
                    if source == chat[ply].btnClose then
                        destroyChatWindow(ply)
                        guiSetInputEnabled(false)
                    elseif source == chat[ply].btnSend then
                        sendChatMessage(ply)
                        guiSetInputEnabled(false)
                    end
                end
            end
        elseif getElementType(source) == "gui-edit" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if source == chat[ply].edit then
                    guiSetInputEnabled(true)
                end
            end
        else
            guiSetInputEnabled(false)
        end
    end
end
 
event_gui_doubleclick = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if source == grdPlayers then
            local row, col = guiGridListGetSelectedItem(grdPlayers)
            --outputDebugString("double clicked row: "..tostring(row))
            if row == -1 or col == -1 then return end              
            local name = guiGridListGetItemText(grdPlayers, row, col)
            local ply = getPlayerFromName(name)
            if not chat[ply] then
                buildChatWindow(ply)
            end
            guiBringToFront(chat[ply].wnd)         
        end
    end
end
 
event_gui_accepted = function(element)
    local parent = getElementParent(source)
    if parent ~= false then
        local ply = getPlayerFromName(guiGetText(parent))
        if ply then
            if element == chat[ply].edit then
                sendChatMessage(ply)
            end
        end
   
Link to comment
No,

i'm not your Buttler lol.

You just have to change some lines.

So why are you writing?? I wrote if one would please the entire code .. and I do not know how to change all the lines .. if you write to me the entire code I'd somehow learned.

Link to comment
No,

i'm not your Buttler lol.

You just have to change some lines.

So why are you writing?? I wrote if one would please the entire code .. and I do not know how to change all the lines .. if you write to me the entire code I'd somehow learned.

he helped you very good

so do the rest on youre own you lazy basterd

Link to comment
No,

i'm not your Buttler lol.

You just have to change some lines.

So why are you writing?? I wrote if one would please the entire code .. and I do not know how to change all the lines .. if you write to me the entire code I'd somehow learned.

he helped you very good

so do the rest on youre own you lazy basterd

You're not into it do not worry when you know there cursing cursing at home and not me .. when you do not want to help so do not write here rather nicely .. I asked if someone would write all the code ..

Link to comment
  • Moderators
You're not into it do not worry when you know there cursing cursing at home and not me .. when you do not want to help so do not write here rather nicely .. I asked if someone would write all the code ..

In which world are you living sriously ?! You aren't the only guy asking for help, it's not the Lol987's forum here ...

We are here to help others to fix their own code.

And KRZO just gave the line you have to copy/paste everywhere this script get the player name.

Or just put this on top of your script:

local _getPlayerName = getPlayerName 
local getPlayerName = function ( player ) 
    return _getPlayerName( player ):gsub("#%x%x%x%x%x%x","") 
end 

Link to comment
You're not into it do not worry when you know there cursing cursing at home and not me .. when you do not want to help so do not write here rather nicely .. I asked if someone would write all the code ..

In which world are you living sriously ?! You aren't the only guy asking for help, it's not the Lol987's forum here ...

We are here to help others to fix their own code.

And KRZO just gave the line you have to copy/paste everywhere this script get the player name.

Or just put this on top of your script:

local _getPlayerName = getPlayerName 
local getPlayerName = function ( player ) 
    return _getPlayerName( player ):gsub("#%x%x%x%x%x%x","") 
end 

Since when do you own? haha everyone here talks about help me here so do not write crap .. unless you're gonna help you not only do not write .. when I say that once you know where I put the String.gsub so probably I do not understand or do not you know? once you pretty please someone write down all the code?

Link to comment
  • Moderators
Since when do you own? haha everyone here talks about help me here so do not write crap .. unless you're gonna help you not only do not write .. when I say that once you know where I put the String.gsub so probably I do not understand or do not you know? once you pretty please someone write down all the code?

Ok let's invert the roles ... Don't "say crap" if you aren't giving feedbacks about the solutions we are giving to you, just don't post. You are supposed to be powerless than members helping you (I just mean here that you are not the king on your topics, you can't apply your own rights and says what members should do for you).

And you didn't even try the 2nd solution. We are helping you on our free time, show the respect we deserve.

If you aren't agree with that then you can just leave this forum and again:

just put this on top of your script:
local _getPlayerName = getPlayerName 
local getPlayerName = function ( player ) 
    return _getPlayerName( player ):gsub("#%x%x%x%x%x%x","") 
end 

Link to comment
Since when do you own? haha everyone here talks about help me here so do not write crap .. unless you're gonna help you not only do not write .. when I say that once you know where I put the String.gsub so probably I do not understand or do not you know? once you pretty please someone write down all the code?

Ok let's invert the roles ... Don't "say crap" if you aren't giving feedbacks about the solutions we are giving to you, just don't post. You are supposed to be powerless than members helping you (I just mean here that you are not the king on your topics, you can't apply your own rights and says what members should do for you).

And you didn't even try the 2nd solution. We are helping you on our free time, show the respect we deserve.

If you aren't agree with that then you can just leave this forum and again:

just put this on top of your script:
local _getPlayerName = getPlayerName 
local getPlayerName = function ( player ) 
    return _getPlayerName( player ):gsub("#%x%x%x%x%x%x","") 
  
end 
  

You'll understand that I do not know where all this I put some? ...

Link to comment

Huh, just copy all this.

--- DONT TRY TO COPY LITTLE BITCH 
 
g_LocalPlayer = getLocalPlayer()
g_Root = getRootElement()
g_ThisResource = getThisResource()
g_ResourceRoot = getResourceRootElement(getThisResource())
 
chat = {} -- table to store chat windows in
newmsg = {show=false, tick=getTickCount(), showtime=5000, img=nil, lbl=nil } -- new msg table
 
 
anims = {}
 
function buildPlayerList()
    local x,y = guiGetScreenSize()
    local width,height = 175,350
    x = x-width
    y = (y-height)/2
    newmsg.img = guiCreateStaticImage(681.0000,134.0000, 42.0000,34.0000, "image/chat-icon.png", false) -- mail message icon
    newmsg.lbl = guiCreateLabel(553.0000,175.0000, 244.0000, 19.0000, "", false)
        guiLabelSetHorizontalAlign(newmsg.lbl, "right", true)
    guiSetAlpha(newmsg.img, 0)
    --guiSetAlpha(newmsg.lbl, 0)
   
    wndPlayers = guiCreateWindow(x,y,width,height, "Private Chat", false)
    grdPlayers = guiCreateGridList(.025,.065, .975,.915, true, wndPlayers)
        colPlayers = guiGridListAddColumn(grdPlayers, "Players", 0.85)
 
    local players = getElementsByType("player")
    for k,v in ipairs(players) do
        addPlayerToList(v)
    end
   
    guiWindowSetSizable(wndPlayers, false)
    guiSetProperty(wndPlayers, "RollUpEnabled", "true")
    guiSetProperty(wndPlayers, "Dragable", "true")
    guiSetAlpha(wndPlayers, 0)
   
   
    -- create animations for it
    anims.plfadein = Animation.create(wndPlayers, Animation.presets.guiFadeIn(1000))
    anims.plfadeout = Animation.create(wndPlayers, Animation.presets.guiFadeOut(1000))
 
    anims.nmfadein = Animation.create(newmsg.img, Animation.presets.guiFadeIn(1000))
    anims.nmfadeout = Animation.create(newmsg.img, Animation.presets.guiFadeOut(1000))
   
    anims.nmtextin = Animation.create(newmsg.lbl, Animation.presets.guiFadeIn(1000))
    anims.nmtextout = Animation.create(newmsg.lbl, Animation.presets.guiFadeOut(1000))
   
--[[    local x,y = guiGetPosition(newmsg.img)
    outputDebugString("guigetPostions: " ..tostring(x).." "..tostring(y))
    local scrx,scry = guiGetScreenSize()
    anims.nmslidein = Animation.create(newmsg.img, Animation.presets.guiMove(x,y))--, 1000,false, scrx,scry, false))
    anims.nmslideout = Animation.create(newmsg.img, Animation.presets.guiMove(scrx,scry))--, 1000,false, x,y, false))
]] 
    bindKey("F2", "down", togglePmGui) 
end
function addPlayerToList(ply)
    --outputDebugString("addPlayerToList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local row = guiGridListAddRow(grdPlayers)
    local name=getPlayerName(ply):gsub("#%x%x%x%x%x%x","")
    guiGridListSetItemText(grdPlayers,row,colPlayers, name, false, false)
end
function removePlayerFromList(ply)
    --outputDebugString("removePlayerFromList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local name=getPlayerName(ply):gsub("#%x%x%x%x%x%x","")
    for row=0,guiGridListGetRowCount(grdPlayers) do
        if guiGridListGetItemText(grdPlayers, row, colPlayers) == name then
            guiGridListRemoveRow(grdPlayers, row)
            outputDebugString("remove row" ..tostring(row))
        end
    end
end
 
 
function showPmGui(state)
    if state == true then
        anims.plfadein:play()
        for k,v in pairs(chat) do
            guiSetVisible(chat[k].wnd,true)
        end
        showCursor(true)
    elseif state == false then
        anims.plfadeout:play()
        for k,v in pairs(chat) do   
            guiSetVisible(chat[k].wnd,false)
        end
        showCursor(false)
        guiSetInputEnabled(false)
    end
end
function togglePmGui()
    if not anims.plfadein:isPlaying() and not anims.plfadeout:isPlaying() then
        if guiGetAlpha(wndPlayers) > .1 then showPmGui(false)
        else showPmGui(true)
        end
    end
end
 
function buildChatWindow(ply)
    local x,y = guiGetScreenSize()
    local width,height = 300,250
    x = x*.5
    y = y*.5
   
    chat[ply] = {}
    chat[ply].wnd = guiCreateWindow(x,y,width,height, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") , false)
    chat[ply].memo = guiCreateMemo(.025,.075, .95,.55, "", true, chat[ply].wnd)
    chat[ply].edit = guiCreateEdit(.025,.65, .95,.15, "", true, chat[ply].wnd)
    chat[ply].btnClose = guiCreateButton(.1,.83, .3,.125, "Close", true, chat[ply].wnd)
    chat[ply].btnSend = guiCreateButton(.6,.83, .3,.125, "Send", true, chat[ply].wnd)
   
    guiMemoSetReadOnly(chat[ply].memo, true)
   
    guiWindowSetSizable(chat[ply].wnd, false)
    guiSetProperty(chat[ply].wnd, "RollUpEnabled", "true")
    guiSetProperty(chat[ply].wnd, "Dragable", "true")
   
    if anims.plfadein:isPlaying() then-- in process of fading in
        guiSetVisible(chat[ply].wnd, true)
    elseif anims.plfadeout:isPlaying() then -- in process of fading out
        guiSetVisible(chat[ply].wnd, false)
    else -- not in process of either
        if guiGetAlpha(wndPlayers) > .1 then
            guiSetVisible(chat[ply].wnd, true) -- is showing
        else
            guiSetVisible(chat[ply].wnd, false) -- isnt showing
        end 
    end
end
function destroyChatWindow(ply)
    if chat[ply] and isElement(chat[ply].wnd) then
        destroyElement(chat[ply].wnd)
        chat[ply] = nil 
    end
end
 
function sendChatMessage(ply)
    --outputDebugString("sendChatMessage: " .. tostring(ply))
    if chat[ply] and isElement(chat[ply].wnd) then
        local newText = guiGetText(chat[ply].edit)
        if newText and string.len(newText) > 0 then
            local oldText = guiGetText(chat[ply].memo)
            if not oldText then oldText = "" end
            oldText = oldText .. getPlayerName(g_LocalPlayer):gsub("#%x%x%x%x%x%x","") .. ": " .. newText .. "\n"
            guiSetText(chat[ply].memo, oldText)
            guiSetText(chat[ply].edit, "")
            guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
 
            triggerServerEvent("onGUIPrivateMessage", g_LocalPlayer, ply,newText)
        end 
    end
end
function recieveChatMessage(ply, msg)
    --outputDebugString("recieveChatMessage: " .. msg)
    if not chat[ply] then
        buildChatWindow(ply)
    end
   
    newmsg.show = true
    newmsg.tick = getTickCount()
   
    ---guiSetText(newmsg.lbl, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n")
guiSetText(newmsg.lbl, "New Messages " .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. "\n")
    anims.nmfadein:play()
    anims.nmtextin:play()
    --anims.nmslidein:play()
 
    local oldText = guiGetText(chat[ply].memo)
    if not oldText then oldText = "" end
    oldText = oldText .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n"
    guiSetText(chat[ply].memo, oldText)
    guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
end
 
event_resource_start = function(res)
    buildPlayerList()
    outputChatBox("",255,255,255,true)
end
 
event_resource_stop = function(res)
    unbindKey("F2", "down", togglePmGui)   
    showPmGui(false)
end
 
event_player_join = function()
    --outputDebugString("onClientPlayerJoin")
    addPlayerToList(source)
end
 
event_player_quit = function()
    --outputDebugString("onClientPlayerQuit")
    removePlayerFromList(source)
    destroyChatWindow(source)
end
 
event_gui_click = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if getElementType(source) == "gui-button" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if ply then
                    if source == chat[ply].btnClose then
                        destroyChatWindow(ply)[youtube][/youtube]
                        guiSetInputEnabled(false)
                    elseif source == chat[ply].btnSend then
                        sendChatMessage(ply)
                        guiSetInputEnabled(false)
                    end
                end
            end
        elseif getElementType(source) == "gui-edit" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if source == chat[ply].edit then
                    guiSetInputEnabled(true)
                end
            end
        else
            guiSetInputEnabled(false)
        end
    end
end
 
event_gui_doubleclick = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if source == grdPlayers then
            local row, col = guiGridListGetSelectedItem(grdPlayers)
            --outputDebugString("double clicked row: "..tostring(row))
            if row == -1 or col == -1 then return end              
            local name = guiGridListGetItemText(grdPlayers, row, col)
            local ply = getPlayerFromName(name)
            if not chat[ply] then
                buildChatWindow(ply)
            end
            guiBringToFront(chat[ply].wnd)         
        end
    end
end
 
event_gui_accepted = function(element)
    local parent = getElementParent(source)
    if parent ~= false then
        local ply = getPlayerFromName(guiGetText(parent))
        if ply then
            if element == chat[ply].edit then
                sendChatMessage(ply)
            end
        end
   
Edited by Guest
Link to comment
Huh, just copy all this.
--- DONT TRY TO COPY LITTLE BITCH 
  _getPlayerName = getPlayerName
local getPlayerName = function ( player )
  return _getPlayerName( player ):gsub("#%x%x%x%x%x%x","")
end
 
g_LocalPlayer = getLocalPlayer()
g_Root = getRootElement()
g_ThisResource = getThisResource()
g_ResourceRoot = getResourceRootElement(getThisResource())
 
chat = {} -- table to store chat windows in
newmsg = {show=false, tick=getTickCount(), showtime=5000, img=nil, lbl=nil } -- new msg table
 
anims = {}
 
function buildPlayerList()
    local x,y = guiGetScreenSize()
    local width,height = 175,350
    x = x-width
    y = (y-height)/2
    newmsg.img = guiCreateStaticImage(681.0000,134.0000, 42.0000,34.0000, "image/chat-icon.png", false) -- mail message icon
    newmsg.lbl = guiCreateLabel(553.0000,175.0000, 244.0000, 19.0000, "", false)
        guiLabelSetHorizontalAlign(newmsg.lbl, "right", true)
    guiSetAlpha(newmsg.img, 0)
    --guiSetAlpha(newmsg.lbl, 0)
   
    wndPlayers = guiCreateWindow(x,y,width,height, "Private Chat", false)
    grdPlayers = guiCreateGridList(.025,.065, .975,.915, true, wndPlayers)
        colPlayers = guiGridListAddColumn(grdPlayers, "Players", 0.85)
 
    local players = getElementsByType("player")
    for k,v in ipairs(players) do
        addPlayerToList(v)
    end
   
    guiWindowSetSizable(wndPlayers, false)
    guiSetProperty(wndPlayers, "RollUpEnabled", "true")
    guiSetProperty(wndPlayers, "Dragable", "true")
    guiSetAlpha(wndPlayers, 0)
   
   
    -- create animations for it
    anims.plfadein = Animation.create(wndPlayers, Animation.presets.guiFadeIn(1000))
    anims.plfadeout = Animation.create(wndPlayers, Animation.presets.guiFadeOut(1000))
 
    anims.nmfadein = Animation.create(newmsg.img, Animation.presets.guiFadeIn(1000))
    anims.nmfadeout = Animation.create(newmsg.img, Animation.presets.guiFadeOut(1000))
   
    anims.nmtextin = Animation.create(newmsg.lbl, Animation.presets.guiFadeIn(1000))
    anims.nmtextout = Animation.create(newmsg.lbl, Animation.presets.guiFadeOut(1000))
   
--[[    local x,y = guiGetPosition(newmsg.img)
    outputDebugString("guigetPostions: " ..tostring(x).." "..tostring(y))
    local scrx,scry = guiGetScreenSize()
    anims.nmslidein = Animation.create(newmsg.img, Animation.presets.guiMove(x,y))--, 1000,false, scrx,scry, false))
    anims.nmslideout = Animation.create(newmsg.img, Animation.presets.guiMove(scrx,scry))--, 1000,false, x,y, false))
]] 
    bindKey("F2", "down", togglePmGui) 
end
function addPlayerToList(ply)
    --outputDebugString("addPlayerToList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local row = guiGridListAddRow(grdPlayers)
    local name = getPlayerName(ply)
    guiGridListSetItemText(grdPlayers,row,colPlayers, name, false, false)
end
function removePlayerFromList(ply)
    --outputDebugString("removePlayerFromList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local name=getPlayerName(ply)
    for row=0,guiGridListGetRowCount(grdPlayers) do
        if guiGridListGetItemText(grdPlayers, row, colPlayers) == name then
            guiGridListRemoveRow(grdPlayers, row)
            outputDebugString("remove row" ..tostring(row))
        end
    end
end
 
 
function showPmGui(state)
    if state == true then
        anims.plfadein:play()
        for k,v in pairs(chat) do
            guiSetVisible(chat[k].wnd,true)
        end
        showCursor(true)
    elseif state == false then
        anims.plfadeout:play()
        for k,v in pairs(chat) do   
            guiSetVisible(chat[k].wnd,false)
        end
        showCursor(false)
        guiSetInputEnabled(false)
    end
end
function togglePmGui()
    if not anims.plfadein:isPlaying() and not anims.plfadeout:isPlaying() then
        if guiGetAlpha(wndPlayers) > .1 then showPmGui(false)
        else showPmGui(true)
        end
    end
end
 
function buildChatWindow(ply)
    local x,y = guiGetScreenSize()
    local width,height = 300,250
    x = x*.5
    y = y*.5
   
    chat[ply] = {}
    chat[ply].wnd = guiCreateWindow(x,y,width,height, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") , false)
    chat[ply].memo = guiCreateMemo(.025,.075, .95,.55, "", true, chat[ply].wnd)
    chat[ply].edit = guiCreateEdit(.025,.65, .95,.15, "", true, chat[ply].wnd)
    chat[ply].btnClose = guiCreateButton(.1,.83, .3,.125, "Close", true, chat[ply].wnd)
    chat[ply].btnSend = guiCreateButton(.6,.83, .3,.125, "Send", true, chat[ply].wnd)
   
    guiMemoSetReadOnly(chat[ply].memo, true)
   
    guiWindowSetSizable(chat[ply].wnd, false)
    guiSetProperty(chat[ply].wnd, "RollUpEnabled", "true")
    guiSetProperty(chat[ply].wnd, "Dragable", "true")
   
    if anims.plfadein:isPlaying() then-- in process of fading in
        guiSetVisible(chat[ply].wnd, true)
    elseif anims.plfadeout:isPlaying() then -- in process of fading out
        guiSetVisible(chat[ply].wnd, false)
    else -- not in process of either
        if guiGetAlpha(wndPlayers) > .1 then
            guiSetVisible(chat[ply].wnd, true) -- is showing
        else
            guiSetVisible(chat[ply].wnd, false) -- isnt showing
        end 
    end
end
function destroyChatWindow(ply)
    if chat[ply] and isElement(chat[ply].wnd) then
        destroyElement(chat[ply].wnd)
        chat[ply] = nil 
    end
end
 
function sendChatMessage(ply)
    --outputDebugString("sendChatMessage: " .. tostring(ply))
    if chat[ply] and isElement(chat[ply].wnd) then
        local newText = guiGetText(chat[ply].edit)
        if newText and string.len(newText) > 0 then
            local oldText = guiGetText(chat[ply].memo)
            if not oldText then oldText = "" end
            oldText = oldText .. getPlayerName(g_LocalPlayer):gsub("#%x%x%x%x%x%x","") .. ": " .. newText .. "\n"
            guiSetText(chat[ply].memo, oldText)
            guiSetText(chat[ply].edit, "")
            guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
 
            triggerServerEvent("onGUIPrivateMessage", g_LocalPlayer, ply,newText)
        end 
    end
end
function recieveChatMessage(ply, msg)
    --outputDebugString("recieveChatMessage: " .. msg)
    if not chat[ply] then
        buildChatWindow(ply)
    end
   
    newmsg.show = true
    newmsg.tick = getTickCount()
   
    ---guiSetText(newmsg.lbl, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n")
guiSetText(newmsg.lbl, "New Messages " .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. "\n")
    anims.nmfadein:play()
    anims.nmtextin:play()
    --anims.nmslidein:play()
 
    local oldText = guiGetText(chat[ply].memo)
    if not oldText then oldText = "" end
    oldText = oldText .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n"
    guiSetText(chat[ply].memo, oldText)
    guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
end
 
event_resource_start = function(res)
    buildPlayerList()
    outputChatBox("",255,255,255,true)
end
 
event_resource_stop = function(res)
    unbindKey("F2", "down", togglePmGui)   
    showPmGui(false)
end
 
event_player_join = function()
    --outputDebugString("onClientPlayerJoin")
    addPlayerToList(source)
end
 
event_player_quit = function()
    --outputDebugString("onClientPlayerQuit")
    removePlayerFromList(source)
    destroyChatWindow(source)
end
 
event_gui_click = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if getElementType(source) == "gui-button" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if ply then
                    if source == chat[ply].btnClose then
                        destroyChatWindow(ply)[youtube][/youtube]
                        guiSetInputEnabled(false)
                    elseif source == chat[ply].btnSend then
                        sendChatMessage(ply)
                        guiSetInputEnabled(false)
                    end
                end
            end
        elseif getElementType(source) == "gui-edit" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if source == chat[ply].edit then
                    guiSetInputEnabled(true)
                end
            end
        else
            guiSetInputEnabled(false)
        end
    end
end
 
event_gui_doubleclick = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if source == grdPlayers then
            local row, col = guiGridListGetSelectedItem(grdPlayers)
            --outputDebugString("double clicked row: "..tostring(row))
            if row == -1 or col == -1 then return end              
            local name = guiGridListGetItemText(grdPlayers, row, col)
            local ply = getPlayerFromName(name)
            if not chat[ply] then
                buildChatWindow(ply)
            end
            guiBringToFront(chat[ply].wnd)         
        end
    end
end
 
event_gui_accepted = function(element)
    local parent = getElementParent(source)
    if parent ~= false then
       
Link to comment
Copy the code again from my first post.

Now it does not turn on at all :(

Try to debug ( go to your server and login > type/debugscript 3 ) it. Since I'm on from mobile, I can't scroll +200 lines. :$

When I put / debug script 3 so I wrote this ERROR: Loading script failed: CHAT/client.mac: 205: unexpected symbol near '/'

Link to comment
g_LocalPlayer = getLocalPlayer() 
g_Root = getRootElement()
g_ThisResource = getThisResource()
g_ResourceRoot = getResourceRootElement(getThisResource())
 
chat = {} -- table to store chat windows in
newmsg = {show=false, tick=getTickCount(), showtime=5000, img=nil, lbl=nil } -- new msg table
 
 
anims = {}
 
local _getPlayerName = getPlayerName
local function getPlayerName ( player )
    return _getPlayerName ( player ) : gsub ( "#%x%x%x%x%x%x", "" )
end
 
function buildPlayerList()
    local x,y = guiGetScreenSize()
    local width,height = 175,350
    x = x-width
    y = (y-height)/2
    newmsg.img = guiCreateStaticImage(681.0000,134.0000, 42.0000,34.0000, "image/chat-icon.png", false) -- mail message icon
    newmsg.lbl = guiCreateLabel(553.0000,175.0000, 244.0000, 19.0000, "", false)
        guiLabelSetHorizontalAlign(newmsg.lbl, "right", true)
    guiSetAlpha(newmsg.img, 0)
    --guiSetAlpha(newmsg.lbl, 0)
   
    wndPlayers = guiCreateWindow(x,y,width,height, "Private Chat", false)
    grdPlayers = guiCreateGridList(.025,.065, .975,.915, true, wndPlayers)
        colPlayers = guiGridListAddColumn(grdPlayers, "Players", 0.85)
 
    local players = getElementsByType("player")
    for k,v in ipairs(players) do
        addPlayerToList(v)
    end
   
    guiWindowSetSizable(wndPlayers, false)
    guiSetProperty(wndPlayers, "RollUpEnabled", "true")
    guiSetProperty(wndPlayers, "Dragable", "true")
    guiSetAlpha(wndPlayers, 0)
   
   
    -- create animations for it
    anims.plfadein = Animation.create(wndPlayers, Animation.presets.guiFadeIn(1000))
    anims.plfadeout = Animation.create(wndPlayers, Animation.presets.guiFadeOut(1000))
 
    anims.nmfadein = Animation.create(newmsg.img, Animation.presets.guiFadeIn(1000))
    anims.nmfadeout = Animation.create(newmsg.img, Animation.presets.guiFadeOut(1000))
   
    anims.nmtextin = Animation.create(newmsg.lbl, Animation.presets.guiFadeIn(1000))
    anims.nmtextout = Animation.create(newmsg.lbl, Animation.presets.guiFadeOut(1000))
   
--[[    local x,y = guiGetPosition(newmsg.img)
    outputDebugString("guigetPostions: " ..tostring(x).." "..tostring(y))
    local scrx,scry = guiGetScreenSize()
    anims.nmslidein = Animation.create(newmsg.img, Animation.presets.guiMove(x,y))--, 1000,false, scrx,scry, false))
    anims.nmslideout = Animation.create(newmsg.img, Animation.presets.guiMove(scrx,scry))--, 1000,false, x,y, false))
]]
    bindKey("F2", "down", togglePmGui)
end
function addPlayerToList(ply)
    --outputDebugString("addPlayerToList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local row = guiGridListAddRow(grdPlayers)
    local name = getPlayerName(ply)
    guiGridListSetItemText(grdPlayers,row,colPlayers, name, false, false)
end
function removePlayerFromList(ply)
    --outputDebugString("removePlayerFromList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local name=getPlayerName(ply)
    for row=0,guiGridListGetRowCount(grdPlayers) do
        if guiGridListGetItemText(grdPlayers, row, colPlayers) == name then
            guiGridListRemoveRow(grdPlayers, row)
            outputDebugString("remove row" ..tostring(row))
        end
    end
end
 
 
function showPmGui(state)
    if state == true then
        anims.plfadein:play()
        for k,v in pairs(chat) do
            guiSetVisible(chat[k].wnd,true)
        end
        showCursor(true)
    elseif state == false then
        anims.plfadeout:play()
        for k,v in pairs(chat) do  
            guiSetVisible(chat[k].wnd,false)
        end
        showCursor(false)
        guiSetInputEnabled(false)
    end
end
function togglePmGui()
    if not anims.plfadein:isPlaying() and not anims.plfadeout:isPlaying() then
        if guiGetAlpha(wndPlayers) > .1 then showPmGui(false)
        else showPmGui(true)
        end
    end
end
 
function buildChatWindow(ply)
    local x,y = guiGetScreenSize()
    local width,height = 300,250
    x = x*.5
    y = y*.5
   
    chat[ply] = {}
    chat[ply].wnd = guiCreateWindow(x,y,width,height, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") , false)
    chat[ply].memo = guiCreateMemo(.025,.075, .95,.55, "", true, chat[ply].wnd)
    chat[ply].edit = guiCreateEdit(.025,.65, .95,.15, "", true, chat[ply].wnd)
    chat[ply].btnClose = guiCreateButton(.1,.83, .3,.125, "Close", true, chat[ply].wnd)
    chat[ply].btnSend = guiCreateButton(.6,.83, .3,.125, "Send", true, chat[ply].wnd)
   
    guiMemoSetReadOnly(chat[ply].memo, true)
   
    guiWindowSetSizable(chat[ply].wnd, false)
    guiSetProperty(chat[ply].wnd, "RollUpEnabled", "true")
    guiSetProperty(chat[ply].wnd, "Dragable", "true")
   
    if anims.plfadein:isPlaying() then-- in process of fading in
        guiSetVisible(chat[ply].wnd, true)
    elseif anims.plfadeout:isPlaying() then -- in process of fading out
        guiSetVisible(chat[ply].wnd, false)
    else -- not in process of either
        if guiGetAlpha(wndPlayers) > .1 then
            guiSetVisible(chat[ply].wnd, true) -- is showing
        else
            guiSetVisible(chat[ply].wnd, false) -- isnt showing
        end
    end
end
function destroyChatWindow(ply)
    if chat[ply] and isElement(chat[ply].wnd) then
        destroyElement(chat[ply].wnd)
        chat[ply] = nil
    end
end
 
function sendChatMessage(ply)
    --outputDebugString("sendChatMessage: " .. tostring(ply))
    if chat[ply] and isElement(chat[ply].wnd) then
        local newText = guiGetText(chat[ply].edit)
        if newText and string.len(newText) > 0 then
            local oldText = guiGetText(chat[ply].memo)
            if not oldText then oldText = "" end
            oldText = oldText .. getPlayerName(g_LocalPlayer):gsub("#%x%x%x%x%x%x","") .. ": " .. newText .. "\n"
            guiSetText(chat[ply].memo, oldText)
            guiSetText(chat[ply].edit, "")
            guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
 
            triggerServerEvent("onGUIPrivateMessage", g_LocalPlayer, ply,newText)
        end
    end
end
function recieveChatMessage(ply, msg)
    --outputDebugString("recieveChatMessage: " .. msg)
    if not chat[ply] then
        buildChatWindow(ply)
    end
   
    newmsg.show = true
    newmsg.tick = getTickCount()
   
    ---guiSetText(newmsg.lbl, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n")
guiSetText(newmsg.lbl, "New Messages " .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. "\n")
    anims.nmfadein:play()
    anims.nmtextin:play()
    --anims.nmslidein:play()
 
    local oldText = guiGetText(chat[ply].memo)
    if not oldText then oldText = "" end
    oldText = oldText .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n"
    guiSetText(chat[ply].memo, oldText)
    guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
end
 
event_resource_start = function(res)
    buildPlayerList()
    outputChatBox("",255,255,255,true)
end
 
event_resource_stop = function(res)
    unbindKey("F2", "down", togglePmGui)  
    showPmGui(false)
end
 
event_player_join = function()
    --outputDebugString("onClientPlayerJoin")
    addPlayerToList(source)
end
 
event_player_quit = function()
    --outputDebugString("onClientPlayerQuit")
    removePlayerFromList(source)
    destroyChatWindow(source)
end
 
event_gui_click = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if getElementType(source) == "gui-button" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if ply then
                    if source == chat[ply].btnClose then
                        destroyChatWindow(ply)
                        guiSetInputEnabled(false)
                    elseif source == chat[ply].btnSend then
                        sendChatMessage(ply)
                        guiSetInputEnabled(false)
                    end
                end
            end
        elseif getElementType(source) == "gui-edit" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if source == chat[ply].edit then
                    guiSetInputEnabled(true)
                end
            end
        else
            guiSetInputEnabled(false)
        end
    end
end
 
event_gui_doubleclick = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if source == grdPlayers then
            local row, col = guiGridListGetSelectedItem(grdPlayers)
            --outputDebugString("double clicked row: "..tostring(row))
            if row == -1 or col == -1 then return end              
            local name = guiGridListGetItemText(grdPlayers, row, col)
            local ply = getPlayerFromName(name)
            if not chat[ply] then
                buildChatWindow(ply)
            end
            guiBringToFront(chat[ply].wnd)        
        end
    end
end
 
event_gui_accepted = function(element)
    local parent = getElementParent(source)
    if parent ~= false then
        local ply = getPlayerFromName(guiGetText(parent))
        if ply then
            if
Link to comment
g_LocalPlayer = getLocalPlayer() 
g_Root = getRootElement()
g_ThisResource = getThisResource()
g_ResourceRoot = getResourceRootElement(getThisResource())
 
chat = {} -- table to store chat windows in
newmsg = {show=false, tick=getTickCount(), showtime=5000, img=nil, lbl=nil } -- new msg table
 
 
anims = {}
 
local _getPlayerName = getPlayerName
local function getPlayerName ( player )
    return _getPlayerName ( player ) : gsub ( "#%x%x%x%x%x%x", "" )
end
 
function buildPlayerList()
    local x,y = guiGetScreenSize()
    local width,height = 175,350
    x = x-width
    y = (y-height)/2
    newmsg.img = guiCreateStaticImage(681.0000,134.0000, 42.0000,34.0000, "image/chat-icon.png", false) -- mail message icon
    newmsg.lbl = guiCreateLabel(553.0000,175.0000, 244.0000, 19.0000, "", false)
        guiLabelSetHorizontalAlign(newmsg.lbl, "right", true)
    guiSetAlpha(newmsg.img, 0)
    --guiSetAlpha(newmsg.lbl, 0)
   
    wndPlayers = guiCreateWindow(x,y,width,height, "Private Chat", false)
    grdPlayers = guiCreateGridList(.025,.065, .975,.915, true, wndPlayers)
        colPlayers = guiGridListAddColumn(grdPlayers, "Players", 0.85)
 
    local players = getElementsByType("player")
    for k,v in ipairs(players) do
        addPlayerToList(v)
    end
   
    guiWindowSetSizable(wndPlayers, false)
    guiSetProperty(wndPlayers, "RollUpEnabled", "true")
    guiSetProperty(wndPlayers, "Dragable", "true")
    guiSetAlpha(wndPlayers, 0)
   
   
    -- create animations for it
    anims.plfadein = Animation.create(wndPlayers, Animation.presets.guiFadeIn(1000))
    anims.plfadeout = Animation.create(wndPlayers, Animation.presets.guiFadeOut(1000))
 
    anims.nmfadein = Animation.create(newmsg.img, Animation.presets.guiFadeIn(1000))
    anims.nmfadeout = Animation.create(newmsg.img, Animation.presets.guiFadeOut(1000))
   
    anims.nmtextin = Animation.create(newmsg.lbl, Animation.presets.guiFadeIn(1000))
    anims.nmtextout = Animation.create(newmsg.lbl, Animation.presets.guiFadeOut(1000))
   
--[[    local x,y = guiGetPosition(newmsg.img)
    outputDebugString("guigetPostions: " ..tostring(x).." "..tostring(y))
    local scrx,scry = guiGetScreenSize()
    anims.nmslidein = Animation.create(newmsg.img, Animation.presets.guiMove(x,y))--, 1000,false, scrx,scry, false))
    anims.nmslideout = Animation.create(newmsg.img, Animation.presets.guiMove(scrx,scry))--, 1000,false, x,y, false))
]]
    bindKey("F2", "down", togglePmGui)
end
function addPlayerToList(ply)
    --outputDebugString("addPlayerToList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local row = guiGridListAddRow(grdPlayers)
    local name = getPlayerName(ply)
    guiGridListSetItemText(grdPlayers,row,colPlayers, name, false, false)
end
function removePlayerFromList(ply)
    --outputDebugString("removePlayerFromList:" ..getPlayerName(ply)):gsub("#%x%x%x%x%x%x","")
    local name=getPlayerName(ply)
    for row=0,guiGridListGetRowCount(grdPlayers) do
        if guiGridListGetItemText(grdPlayers, row, colPlayers) == name then
            guiGridListRemoveRow(grdPlayers, row)
            outputDebugString("remove row" ..tostring(row))
        end
    end
end
 
 
function showPmGui(state)
    if state == true then
        anims.plfadein:play()
        for k,v in pairs(chat) do
            guiSetVisible(chat[k].wnd,true)
        end
        showCursor(true)
    elseif state == false then
        anims.plfadeout:play()
        for k,v in pairs(chat) do  
            guiSetVisible(chat[k].wnd,false)
        end
        showCursor(false)
        guiSetInputEnabled(false)
    end
end
function togglePmGui()
    if not anims.plfadein:isPlaying() and not anims.plfadeout:isPlaying() then
        if guiGetAlpha(wndPlayers) > .1 then showPmGui(false)
        else showPmGui(true)
        end
    end
end
 
function buildChatWindow(ply)
    local x,y = guiGetScreenSize()
    local width,height = 300,250
    x = x*.5
    y = y*.5
   
    chat[ply] = {}
    chat[ply].wnd = guiCreateWindow(x,y,width,height, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") , false)
    chat[ply].memo = guiCreateMemo(.025,.075, .95,.55, "", true, chat[ply].wnd)
    chat[ply].edit = guiCreateEdit(.025,.65, .95,.15, "", true, chat[ply].wnd)
    chat[ply].btnClose = guiCreateButton(.1,.83, .3,.125, "Close", true, chat[ply].wnd)
    chat[ply].btnSend = guiCreateButton(.6,.83, .3,.125, "Send", true, chat[ply].wnd)
   
    guiMemoSetReadOnly(chat[ply].memo, true)
   
    guiWindowSetSizable(chat[ply].wnd, false)
    guiSetProperty(chat[ply].wnd, "RollUpEnabled", "true")
    guiSetProperty(chat[ply].wnd, "Dragable", "true")
   
    if anims.plfadein:isPlaying() then-- in process of fading in
        guiSetVisible(chat[ply].wnd, true)
    elseif anims.plfadeout:isPlaying() then -- in process of fading out
        guiSetVisible(chat[ply].wnd, false)
    else -- not in process of either
        if guiGetAlpha(wndPlayers) > .1 then
            guiSetVisible(chat[ply].wnd, true) -- is showing
        else
            guiSetVisible(chat[ply].wnd, false) -- isnt showing
        end
    end
end
function destroyChatWindow(ply)
    if chat[ply] and isElement(chat[ply].wnd) then
        destroyElement(chat[ply].wnd)
        chat[ply] = nil
    end
end
 
function sendChatMessage(ply)
    --outputDebugString("sendChatMessage: " .. tostring(ply))
    if chat[ply] and isElement(chat[ply].wnd) then
        local newText = guiGetText(chat[ply].edit)
        if newText and string.len(newText) > 0 then
            local oldText = guiGetText(chat[ply].memo)
            if not oldText then oldText = "" end
            oldText = oldText .. getPlayerName(g_LocalPlayer):gsub("#%x%x%x%x%x%x","") .. ": " .. newText .. "\n"
            guiSetText(chat[ply].memo, oldText)
            guiSetText(chat[ply].edit, "")
            guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
 
            triggerServerEvent("onGUIPrivateMessage", g_LocalPlayer, ply,newText)
        end
    end
end
function recieveChatMessage(ply, msg)
    --outputDebugString("recieveChatMessage: " .. msg)
    if not chat[ply] then
        buildChatWindow(ply)
    end
   
    newmsg.show = true
    newmsg.tick = getTickCount()
   
    ---guiSetText(newmsg.lbl, getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n")
guiSetText(newmsg.lbl, "New Messages " .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. "\n")
    anims.nmfadein:play()
    anims.nmtextin:play()
    --anims.nmslidein:play()
 
    local oldText = guiGetText(chat[ply].memo)
    if not oldText then oldText = "" end
    oldText = oldText .. getPlayerName(ply):gsub("#%x%x%x%x%x%x","") .. ": " .. msg .. "\n"
    guiSetText(chat[ply].memo, oldText)
    guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText))
end
 
event_resource_start = function(res)
    buildPlayerList()
    outputChatBox("",255,255,255,true)
end
 
event_resource_stop = function(res)
    unbindKey("F2", "down", togglePmGui)  
    showPmGui(false)
end
 
event_player_join = function()
    --outputDebugString("onClientPlayerJoin")
    addPlayerToList(source)
end
 
event_player_quit = function()
    --outputDebugString("onClientPlayerQuit")
    removePlayerFromList(source)
    destroyChatWindow(source)
end
 
event_gui_click = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if getElementType(source) == "gui-button" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if ply then
                    if source == chat[ply].btnClose then
                        destroyChatWindow(ply)
                        guiSetInputEnabled(false)
                    elseif source == chat[ply].btnSend then
                        sendChatMessage(ply)
                        guiSetInputEnabled(false)
                    end
                end
            end
        elseif getElementType(source) == "gui-edit" then
            local parent = getElementParent(source)
            if parent ~= false then
                local ply = getPlayerFromName(guiGetText(parent))
                if source == chat[ply].edit then
                    guiSetInputEnabled(true)
                end
            end
        else
            guiSetInputEnabled(false)
        end
    end
end
 
event_gui_doubleclick = function(button, state, absx, absy)
    if button == "left" and state == "up" then
        if source == grdPlayers then
            local row, col = guiGridListGetSelectedItem(grdPlayers)
            --outputDebugString("double clicked row: "..tostring(row))
            if row == -1 or col == -1 then return end              
            local name = guiGridListGetItemText(grdPlayers, row, col)
            local ply = getPlayerFromName(name)
            if not chat[ply] then
                buildChatWindow(ply)
            end
            guiBringToFront(chat[ply].wnd)        
        end
    end
end
 
event_gui_accepted = function(element)
    local parent = getElementParent(source)
    if parent ~= false then
       
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...