xTeacherx Posted October 1, 2012 Share Posted October 1, 2012 (edited) client --******************************************** --******************************************** userPanelWindow = guiCreateWindow(96,39,614,524,"Party ",false) guiSetVisible (userPanelWindow, false) memo = guiCreateMemo(131,76,464,351,"",false,userPanelWindow) playerNameEdit = guiCreateEdit(126,39,475,32,"",false,userPanelWindow) Button1 = guiCreateButton(130,475,109,37,"Add",false,userPanelWindow) Button2 = guiCreateButton(252,475,109,37,"Send",false,userPanelWindow) Button3 = guiCreateButton(378,475,100,36,"Clear",false,userPanelWindow) Button4 = guiCreateButton(494,475,100,36,"Close",false,userPanelWindow) edit2 = guiCreateEdit(126,435,475,32,"",false,userPanelWindow) function onresourceStart () bindKey ("F1", "down", xx) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function xx () getVisible = guiGetVisible (userPanelWindow) playerName = getPlayerName ( getLocalPlayer() ) local playerMoney = getPlayerMoney(source) if (getVisible == true) then guiSetVisible (userPanelWindow, false) showCursor (false) end if (getVisible == false) then guiSetVisible (userPanelWindow, true) showCursor (true) playerGridList = guiCreateGridList(10,28,106,487,false,userPanelWindow) playersColumn = guiGridListAddColumn(playerGridList,"Players",0.85) guiGridListSetSelectionMode(playerGridList,2) for id, plaItem in ipairs(getElementsByType("player")) do row = guiGridListAddRow ( playerGridList ) guiGridListSetItemText ( playerGridList, row, playersColumn, getPlayerName ( plaItem ), false, false ) end addEventHandler( "onClientGUIDoubleClick", playerGridList, setGUI, onGuiClick, outputEditBox ) end end function setGUI ( ) selectedRow, selectedCol = guiGridListGetSelectedItem( playerGridList ) gridPlayerName = guiGridListGetItemText( playerGridList, selectedRow, selectedCol ) guiSetText ( playerNameEdit, gridPlayerName ) end -- msg -- function onGuiClick (button, state, absoluteX, absoluteY) if (source == Button1) then playerNick = guiGetText ( playerNameEdit ) amount = guiGetText ( edit2 ) triggerServerEvent ("sendmsg", getLocalPlayer(), playerNick, amount) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function outputEditBox () local chat = guiGetText(memo) local msg = guiGetText(edit2) triggerServerEvent("onSend",getLocalPlayer(),chat,msg) guiSetText(edit2,"") showCursor( true ) end addEventHandler ( "onClientGUIClick", Button2, outputEditBox ) addEvent("onClient",true) addEventHandler("onClient",getRootElement(), function (chat,msg,name) guiSetText(memo,"" .. name .. " : " .. msg .. "\n" .. chat .. "" ,255,0,0,true) end ) -- close -- addEventHandler ( "onClientGUIClick", root, function () if ( source == Button4 ) then guiSetVisible(userPanelWindow,false) showCursor(false) end end) -- clear -- addEventHandler ( "onClientGUIClick", root, function () if ( source == Button3 ) then guiSetText(memo,"") guiSetText(memo,"") guiSetText(memo,"") guiSetText(memo,"") guiSetText(memo,"") guiSetText(memo,"") guiSetText(memo,"") guiSetText(memo,"") end end) server addEvent("onSend",true) addEventHandler("onSend",getRootElement(), function (sms,msg) local name = getPlayerName(source) triggerClientEvent("onClient",getRootElement(),sms,msg,name) end ) i waanna if i i double click player i will chat with he privte Edited October 2, 2012 by Guest Link to comment
TwiX! Posted October 2, 2012 Share Posted October 2, 2012 https://wiki.multitheftauto.com/wiki/OnC ... oubleClick Link to comment
xTeacherx Posted October 2, 2012 Author Share Posted October 2, 2012 (edited) i do that < but now i wanna if i click to plaer just he will see my words : # Edited October 3, 2012 by Guest Link to comment
TwiX! Posted October 3, 2012 Share Posted October 3, 2012 i give you a normal response see arguments in onClientDoubleClick Link to comment
Castillo Posted October 3, 2012 Share Posted October 3, 2012 --******************************************** --******************************************** userPanelWindow = guiCreateWindow(96,39,614,524,"Party ",false) guiSetVisible (userPanelWindow, false) memo = guiCreateMemo(131,76,464,351,"",false,userPanelWindow) playerNameEdit = guiCreateEdit(126,39,475,32,"",false,userPanelWindow) Button1 = guiCreateButton(130,475,109,37,"Add",false,userPanelWindow) Button2 = guiCreateButton(252,475,109,37,"Send",false,userPanelWindow) Button3 = guiCreateButton(378,475,100,36,"Clear",false,userPanelWindow) Button4 = guiCreateButton(494,475,100,36,"Close",false,userPanelWindow) edit2 = guiCreateEdit(126,435,475,32,"",false,userPanelWindow) playerGridList = guiCreateGridList(10,28,106,487,false,userPanelWindow) playersColumn = guiGridListAddColumn(playerGridList,"Players",0.85) function xx ( ) local playerName = getPlayerName ( localPlayer ) guiSetVisible ( userPanelWindow, not guiGetVisible ( userPanelWindow ) ) showCursor ( guiGetVisible ( userPanelWindow ) ) guiGridListClear ( playerGridList ) for id, plaItem in ipairs ( getElementsByType ( "player" ) ) do row = guiGridListAddRow ( playerGridList ) guiGridListSetItemText ( playerGridList, row, playersColumn, getPlayerName ( plaItem ), false, false ) end end bindKey ( "F1", "down", xx ) function setGUI ( ) local row, col = guiGridListGetSelectedItem ( playerGridList ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerName = guiGridListGetItemText ( playerGridList, row, 1 ) guiSetText ( playerNameEdit, playerName ) end end addEventHandler( "onClientGUIDoubleClick", playerGridList, setGUI, false ) addEvent ( "onClient", true ) addEventHandler ( "onClient", getRootElement(), function ( chat, msg, name ) guiSetText ( memo, name ..": ".. msg .."\n".. chat ) end ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == Button1 ) then local playerNick = guiGetText ( playerNameEdit ) local msg = guiGetText ( edit2 ) triggerServerEvent ( "sendmsg", localPlayer, playerNick, msg ) elseif ( source == Button2 ) then local chat = guiGetText ( memo ) local msg = guiGetText ( edit2 ) triggerServerEvent ( "onSend", localPlayer, chat, msg ) guiSetText ( edit2, "" ) showCursor ( true ) elseif ( source == Button3 ) then guiSetText ( memo, "" ) elseif ( source == Button4 ) then guiSetVisible ( userPanelWindow, false ) showCursor ( false ) end end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now