WASSIm. Posted August 6, 2013 Posted August 6, 2013 hi guys i have question. how make if player create event add in guiGridList exmple "WASSIm. he is created event [2013:8:6][4:05:30]" addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[1] ) then triggerServerEvent ( "onCreateEvent", getRootElement(), localPlayer) local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) column = guiGridListAddColumn(GUIEditor.gridlist[1], "Lest event created", 0.9) end end)
DNL291 Posted August 6, 2013 Posted August 6, 2013 local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] local second = getRealTime()["second"]
WASSIm. Posted August 6, 2013 Author Posted August 6, 2013 local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] local second = getRealTime()["second"] i know howa make date but how make if player click button (GUIEditor.button[1]) created in guiGridList exmple "WASSIm. he is created event"
DNL291 Posted August 6, 2013 Posted August 6, 2013 I don't understand where you want to create that text. Do you want to create a text in a row or what?
WASSIm. Posted August 6, 2013 Author Posted August 6, 2013 I don't understand where you want to create that text.Do you want to create a text in a row or what? i want like that
WASSIm. Posted August 6, 2013 Author Posted August 6, 2013 Use: guiGridListAddRow guiGridListSetItemText can give exmple ? i want learn it. i know all GUI but this i don't understand it
xXMADEXx Posted August 6, 2013 Posted August 6, 2013 Use: guiGridListAddRow guiGridListSetItemText can give exmple ? i want learn it. i know all GUI but this i don't understand it addEventHandler ( "onClientGUIClick", button, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( grid ) guiGridListSetItemText ( grid, row, 1, getPlayerName ( player ), false, false ) end end )
WASSIm. Posted August 6, 2013 Author Posted August 6, 2013 thx i make it but its add just for one addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[1] ) then triggerServerEvent ( "onCreateEvent", getRootElement(), localPlayer) local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] guiGridListSetItemText ( GUIEditor.gridlist[1], row, column, "["..hour..":"..minute.."-"..monthday.."."..month.."."..year.."] "..getPlayerName(localPlayer).." created event ", true, true ) end end )
DNL291 Posted August 7, 2013 Posted August 7, 2013 Try this: addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[1] ) then triggerServerEvent ( "onCreateEvent", getRootElement(), localPlayer) local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText ( GUIEditor.gridlist[1], row, column, "["..hour..":"..minute.."-"..monthday.."."..month.."."..year.."] "..getPlayerName(localPlayer).." created event ", false, false ) end end )
xXMADEXx Posted August 7, 2013 Posted August 7, 2013 thx i make itbut its add just for one addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[1] ) then triggerServerEvent ( "onCreateEvent", getRootElement(), localPlayer) local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] guiGridListSetItemText ( GUIEditor.gridlist[1], row, column, "["..hour..":"..minute.."-"..monthday.."."..month.."."..year.."] "..getPlayerName(localPlayer).." created event ", true, true ) end end ) Thats because you need to loop a table, and create a row every index.
WASSIm. Posted August 7, 2013 Author Posted August 7, 2013 now working but show just what i create i want all player
DNL291 Posted August 8, 2013 Posted August 8, 2013 now working but show just what i create i want all player Because that code is clientside, if you want to show all players whenever any player to create an event, you can use triggerServerEvent or setElementData and put the player name who created the event, then add it in gridList with guiGridListAddRow and guiGridListSetItemText. Edit: addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[1] ) then --triggerServerEvent ( "onCreateEvent", getRootElement(), localPlayer) setElementData(GUIEditor.gridlist[1], "curEventAuthor", getPlayerName(localPlayer)) end end ) addEvent("addNewRow") addEventHandler("addNewRow", root, function(playerName) local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, column, "["..hour..":"..minute.."-"..monthday.."."..month.."."..year.."] "..playerName.." created event ", false, false) end) addEventHandler( "onClientElementDataChange", root, function (dataName, oldValue) if (dataName == "curEventAuthor") then local playerName = getElementData(source, dataName) triggerEvent("addNewRow", root, playerName) end end ) local _setElementData = setElementData function setElementData(elem, theKey, value) if (theKey == "curEventAuthor") then if (getElementData(GUIEditor.gridlist[1], "curEventAuthor") == value) then triggerEvent("addNewRow", root, value) end end _setElementData(elem, theKey, value) end Try it.
WASSIm. Posted August 8, 2013 Author Posted August 8, 2013 i get idea i make log event with xml and working. how make show all log in guiGridList ? make this ? local xmlfile = xmlLoadFile ( "eventlog.xml" ) if xmlfile then local NewNode = xmlNodeGetChildren( xmlfile) for i,node in pairs(NewNode) do local text = xmlNodeGetValue(node) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, text, false, false ) end end
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