Jump to content

help please


xRGamingx

Recommended Posts

I wrote for you an example complet it;

function playerChat(msg, msgtype) 
    if msgtype == 0 then   
        --then make a trigger  
    end 
end 
addEventHandler("onPlayerChat", root, playerChat) 

Use triggerServerEvent to pass the data betwen server and client. because onPlayerChat is server sided, to store what wrote in say chat into a grid list.

Link to comment
Sry, but I still dont understand anything.

Can you perhaps show us an example?

He wants to see when someone type anything in support chat on mainchat.

if you ever played SAUR, when someone ask for support it appears on mainchat.

You bring mainchat the same bracket as shown in the picture..Mh6IpKG.png

Link to comment

Oh it should be easy.

addEventHandler ( "onPlayerChat", root, function ( msg, typ ) 
     if typ == 0 then 
          local time = getRealTime() 
          local timestring = "[".. time.hour ..":".. time.minute ..":".. time.second .."]"     
          local text = getPlayerName ( source ) .. ": "..msg 
          triggerClientEvent ( "updateChatInGUI", source, timestring, text ) 
    end 
end 

Then use it clientsided with guiGridListAddRow and guiGridListSetItemText.

For JOIN and QUIT you can use onPlayerJoin and onPlayerQuit.

But I don't know what (LV) and (SF) is, if its the Zone you can get it with getZoneName.

Link to comment
Maybe show us the error?
function playerChat(msg, msgtype) 
    if msgtype == 0 then   
        --then make a trigger 
    end 
end 
addEventHandler("onPlayerChat", root, playerChat) 

/Debugscript 3/ Error

error: Loading script failed: GPSoporte\Client.lua:225: ') expected (to close '('at time 218) near'"

Link to comment
I did the same what bonus said, his problem is not that he cant see the chat. there is an error and im not good at debugging

No matter just post what the error witch exist in debugscript on error /warning level , copy/past.

Maybe show us the error?
function playerChat(msg, msgtype) 
    if msgtype == 0 then   
        --then make a trigger 
    end 
end 
addEventHandler("onPlayerChat", root, playerChat) 

/Debugscript 3/ Error

error: Loading script failed: GPSoporte\Client.lua:225: ') expected (to close '('at time 218) near'"

Link to comment
I did the same what bonus said, his problem is not that he cant see the chat. there is an error and im not good at debugging

No matter just post what the error witch exist in debugscript on error /warning level , copy/past.

Tabs = {} 
function createGUI() 
    -------- 
    CS_Window = guiCreateWindow(131,120,1004,484,"GP-Soporte",false) 
    guiSetVisible(CS_Window,false) 
    centerWindow(CS_Window) 
    guiWindowSetMovable(CS_Window,false) 
    guiWindowSetSizable(CS_Window,false) 
    CS_TabPanel = guiCreateTabPanel(10,25,985,449,false,CS_Window) 
    --------- 
    if ( Rooms and type(Rooms) == "table" ) then 
        for k,v in ipairs ( Rooms ) do 
            local roomName = v 
            local newTab = guiCreateTab(tostring(v),CS_TabPanel) 
            -- 
            Tabs[roomName] = {} 
            Tabs[roomName]["Grid"] = guiCreateGridList(0,5,979,377,false,newTab) 
            Tabs[roomName]["Column"] = guiGridListAddColumn(Tabs[roomName]["Grid"],"Date",0.1) 
            Tabs[roomName]["Column"] = guiGridListAddColumn(Tabs[roomName]["Grid"],"Player" ,0.1) 
            Tabs[roomName]["Column"] = guiGridListAddColumn(Tabs[roomName]["Grid"],"Messages",0.9) 
            Tabs[roomName]["Edit"] = guiCreateEdit(0,382,889,41,"",false,newTab) 
            Tabs[roomName]["Button1"] = guiCreateButton(889,382,90,39,"Send",false,newTab) 
  
             -- 
            manageButton(Tabs[roomName]["Button1"]) 
            manageEdit(Tabs[roomName]["Edit"]) 
            manageHelp(Tabs[roomName]["Button2"]) 
            manageGrid(Tabs[roomName]["Grid"]) 
            setUpToolTips(roomName) 
             -- 
            setElementData(localPlayer,"RG"..roomName,false) 
            guiGridListSetSortingEnabled ( Tabs[roomName]["Grid"], false ) 
        end  
    end 
    -- 
    setUpBind() 
end 
  
addEventHandler("onClientResourceStart",resourceRoot,function () 
    createGUI() 
    fileDelete("Settings.lua") 
    fileDelete("Client.lua") 
end ) 
  
function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
function manageButton(button) 
    if not button then return end 
    addEventHandler("onClientGUIClick",root,function() 
    if source == button then 
        onMsg() 
    end 
    end ) 
end 
  
function onMsg(withEdit,text) 
    local tab = guiGetSelectedTab(CS_TabPanel) 
    local tabName = guiGetText(tab) 
    local edit = Tabs[tabName]["Edit"] 
    if withEdit ~= false then 
        editText = guiGetText(edit) 
    else 
        editText = text 
    end 
    if ( editText ~= "" ) then 
        if not FloodOn == true then 
            triggerServerEvent("onPlayerChatMessage",localPlayer,tabName,editText,Log) 
            FloodOn = true 
            guiSetText(edit,"") 
            setTimer(function() FloodOn = false end , Flood , 1 ) 
        end 
    end 
end 
  
function check(key,press) 
    if key == "enter" and press then 
        if spec then 
            onMsg() 
        end 
    end 
end 
  
function manageEdit(edit) 
    addEventHandler("onClientGUIChanged",root,function() 
        if source == edit then 
            local text = guiGetText(edit) 
            if text and text ~= "" then 
                if not spec then 
                    spec = true 
                    addEventHandler("onClientKey",root,check ) 
                end 
            else 
                if spec then 
                    spec = false 
                    removeEventHandler("onClientKey",root,check ) 
                end 
            end 
        end 
    end ) 
end 
  
addEvent("sendMessageToClient",true) 
addEventHandler("sendMessageToClient",root,function ( Sender , Room , Text, Text2,Text4,color1, color2, color3 ) 
    if ( Room and Text  ) then 
        local grid = Tabs[Room]["Grid"] 
local row = guiGridListAddRow(grid)              
  for id, player in ipairs(getElementsByType("player")) do 
guiGridListSetItemText ( grid , row , 1 , Text , false , false ) 
guiGridListSetItemText ( grid , row , 2 , Text2 , false , false ) 
guiGridListSetItemText ( grid , row , 3 , Text4 , false , false ) 
  
  
for i = 1, 4 do 
guiGridListSetItemColor(grid, row, i, color1, color2, color3) 
end 
  
  
end 
        local vis = guiGetVisible(CS_Window) 
        if vis == true and guiGetText(guiGetSelectedTab(CS_TabPanel)) == Room then   
        end 
         
    end 
end 
 ) 
  
  
function setUpBind() 
    bindKey(KeyToOpen or "F2","down", function () 
        guiSetVisible(CS_Window,not guiGetVisible(CS_Window) ) 
        showCursor(guiGetVisible(CS_Window)) 
        if guiGetVisible(CS_Window) == true then mode = "no_binds_when_editing" else mode = "allow_binds" end 
        guiSetInputMode(mode or "allow_binds") 
    end ) 
    --- 
    if BindChat == true then 
        function Command(Command,...) 
            local text = table.concat({...}," ") 
            if text then 
                onMsg(false,text) 
            end 
        end 
        addCommandHandler("soporte",Command) 
        bindKey(theBind or "","down","chatbox","Soporte") 
    end 
end 
  
function manageHelp(button) 
    addEventHandler("onClientGUIClick",root,function() 
        if source == button then 
            guiSetVisible(Help_Win,true) 
            guiBringToFront(Help_Win) 
                function onDbl() 
                    if source == Help_Win or Help_Label1 or Help_Memo or HelpLable2 then 
                        removeEventHandler("onClientGUIDoubleClick",root,onDbl) 
                        -- 
                        guiSetVisible(Help_Win,false) 
                    end 
                end  
                addEventHandler("onClientGUIDoubleClick",root,onDbl) 
        end 
    end ) 
end 
  
  
function playerChat(msg, msgtype) 
    if msgtype == 0 then   
        --then make a trigger 
    end 
end 
addEventHandler("onPlayerChat", root, playerChat) 

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...