iFoReX Posted June 24, 2012 Share Posted June 24, 2012 When I press my Button 2 doesnt create the xml and doesnt edit the XML File doesnt work here the codes cl-side GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(168,37,481,519,"Creator Ped GUI",false) GUIEditor_Edit[1] = guiCreateEdit(28,56,96,26,"",false,GUIEditor_Window[1]) GUIEditor_Edit[2] = guiCreateEdit(28,83,96,26,"",false,GUIEditor_Window[1]) GUIEditor_Edit[3] = guiCreateEdit(28,110,96,26,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(29,138,95,31,"Get Positions",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(141,61,44,18,"set Skin",false,GUIEditor_Window[1]) GUIEditor_Edit[4] = guiCreateEdit(188,53,70,30,"",false,GUIEditor_Window[1]) guiEditSetMaxLength(GUIEditor_Edit[4],3) GUIEditor_Label[2] = guiCreateLabel(306,60,70,17,"set Rotation",false,GUIEditor_Window[1]) GUIEditor_Edit[5] = guiCreateEdit(374,53,70,30,"",false,GUIEditor_Window[1]) guiEditSetMaxLength(GUIEditor_Edit[5],3) GUIEditor_Label[3] = guiCreateLabel(143,111,80,31,"Name ID",false,GUIEditor_Window[1]) GUIEditor_Edit[6] = guiCreateEdit(141,130,104,28,"",false,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(16,202,333,308,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) CNameID = guiGridListAddColumn(GUIEditor_Grid[1],"Name ID",0.2) CState = guiGridListAddColumn(GUIEditor_Grid[1],"State",0.2) GUIEditor_Button[2] = guiCreateButton(270,131,91,27,"Create Ped",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(377,131,91,27,"Clear",false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(14,174,503,20,"-----------------------------------------------------------------------------------------",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Button[4] = guiCreateButton(357,218,114,31,"Activate Ped",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(357,464,114,31,"Delete Ped",false,GUIEditor_Window[1]) GUIEditor_Button[6] = guiCreateButton(357,256,114,31,"Disable Ped",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(354,298,115,31,"GUI Made by ElMota (c) 2012",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) addEvent("open:pGUI", true) addEventHandler("open:pGUI",root,function() if guiSetVisible( GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1]) ) then showCursor( guiGetVisible(GUIEditor_Window[1]) ) end end ) addEventHandler("onClientGUIClick",root, function() if source == GUIEditor_Button[3] then local clear1 = guiSetText(GUIEditor_Edit[1],'') local clear2 = guiSetText(GUIEditor_Edit[2],'') local clear3 = guiSetText(GUIEditor_Edit[3],'') local clear4 = guiSetText(GUIEditor_Edit[4],'') local clear5 = guiSetText(GUIEditor_Edit[5],'') local clear6 = guiSetText(GUIEditor_Edit[6],'') if clear1 and clear2 and clear3 and clear4 and clear5 and clear6 then outputChatBox("fields cleared succesfely", getLocalPlayer()) end elseif source == GUIEditor_Button[2] then if guiGetText(GUIEditor_Edit[1]) ~= '' and guiGetText(GUIEditor_Edit[2]) ~= '' and guiGetText(GUIEditor_Edit[3]) ~= '' and guiGetText(GUIEditor_Edit[4]) and guiGetText(GUIEditor_Edit[5]) ~= '' and guiGetText(GUIEditor_Edit[6]) ~= '' then triggerServerEvent("get:Fields", localPlayer, clear1, clear2, clear3, clear4, clear5, clear6, clear7) end elseif source == GUIEditor_Button[1] then local x, y, z = getElementPosition(getLocalPlayer()) guiSetText(GUIEditor_Edit[1], x) guiSetText(GUIEditor_Edit[2], y) guiSetText(GUIEditor_Edit[3], z) end end ) addEvent("get:Values",true) addEventHandler("get:Values", root, function( nameID, state ) if nameID and state then local row = guiGridListAddRow( GUIEditor_Grid[1] ) guiGridListSetItemText(GUIEditor_Grid[1], row, CNameID, nameID, false, false) guiGridListSetItemText(GUIEditor_Grid[1], row, CState, state, false, false) end end ) sv-side addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, thePlayer in ipairs ( getElementsByType ( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) then bindKey ( thePlayer, "F2", "down", bindear ) else outputChatBox("no eres admin",source) end end end ) function bindear ( thePlayer ) triggerClientEvent ( thePlayer, "open:pGUI", thePlayer ) end addEvent("send:Fields",true) addEvent("get:Fields",true) addEventHandler("get:Fields",root,function( clear1,clear2,clear3,clear4,clear5,clear6 ) if clear1 and clear2 and clear3 and clear4 and clear5 and clear6 then local pedXML = xmlLoadFile(":pedGUI/peds/peds.xml") local pChild = xmlCreateChild(pedXML, "ID") local IDPed = xmlNodeSetAttribute(pChild, "Name", clear6) local skin = xmlNodeSetAttribute(pChild, "skin", clear4) local posX = xmlNodeSetAttribute(pChild, "posX", clear1) local posY = xmlNodeSetAttribute(pChild, "posY", clear2) local posZ = xmlNodeSetAttribute(pChild, "posZ", clear3) local rotation = xmlNodeSetAttribute(pChild, "rotation", clear5) local state = xmlNodeSetAttribute(pChild, "state", inactive) if pChild and IDPed and skin and posX and posY and posZ and rotation then outputChatBox("datos transferidos correctamente", source) xmlSaveFile(pedXML) addEventHandler("send:Fields",root,sendFields) end end end ) function sendFields() local pedXML = xmlLoadFile(":pedGUI/peds/peds.xml") local pChild = xmlFindChild(pedXML,"ID",0) local nameID = xmlNodeGetAttribute(pChild,"Name") local state = xmlNodeGetAttribute(pChild, "state") triggerClientEvent("get:Values", source, nameID, state) end 0 problems in debugscript 3 Link to comment
GhostXoP Posted June 24, 2012 Share Posted June 24, 2012 Make sure its not getting over lapped with another gui object Link to comment
iFoReX Posted June 24, 2012 Author Share Posted June 24, 2012 it is the correct GUI Object Link to comment
Guest Guest4401 Posted June 24, 2012 Share Posted June 24, 2012 The problem was you were triggering nil values (clear1, clear2 and so on were nil while being triggered). Anyway, try: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(168,37,481,519,"Creator Ped GUI",false) GUIEditor_Edit[1] = guiCreateEdit(28,56,96,26,"",false,GUIEditor_Window[1]) GUIEditor_Edit[2] = guiCreateEdit(28,83,96,26,"",false,GUIEditor_Window[1]) GUIEditor_Edit[3] = guiCreateEdit(28,110,96,26,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(29,138,95,31,"Get Positions",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(141,61,44,18,"set Skin",false,GUIEditor_Window[1]) GUIEditor_Edit[4] = guiCreateEdit(188,53,70,30,"",false,GUIEditor_Window[1]) guiEditSetMaxLength(GUIEditor_Edit[4],3) GUIEditor_Label[2] = guiCreateLabel(306,60,70,17,"set Rotation",false,GUIEditor_Window[1]) GUIEditor_Edit[5] = guiCreateEdit(374,53,70,30,"",false,GUIEditor_Window[1]) guiEditSetMaxLength(GUIEditor_Edit[5],3) GUIEditor_Label[3] = guiCreateLabel(143,111,80,31,"Name ID",false,GUIEditor_Window[1]) GUIEditor_Edit[6] = guiCreateEdit(141,130,104,28,"",false,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(16,202,333,308,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) CNameID = guiGridListAddColumn(GUIEditor_Grid[1],"Name ID",0.2) CState = guiGridListAddColumn(GUIEditor_Grid[1],"State",0.2) GUIEditor_Button[2] = guiCreateButton(270,131,91,27,"Create Ped",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(377,131,91,27,"Clear",false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(14,174,503,20,"-----------------------------------------------------------------------------------------",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Button[4] = guiCreateButton(357,218,114,31,"Activate Ped",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(357,464,114,31,"Delete Ped",false,GUIEditor_Window[1]) GUIEditor_Button[6] = guiCreateButton(357,256,114,31,"Disable Ped",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(354,298,115,31,"GUI Made by ElMota (c) 2012",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) addEvent("open:pGUI", true) addEventHandler("open:pGUI",root, function() if guiSetVisible( GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1]) ) then showCursor( guiGetVisible(GUIEditor_Window[1]) ) end end ) addEventHandler("onClientGUIClick",root, function() if source == GUIEditor_Button[3] then local clear1 = guiSetText(GUIEditor_Edit[1],'') local clear2 = guiSetText(GUIEditor_Edit[2],'') local clear3 = guiSetText(GUIEditor_Edit[3],'') local clear4 = guiSetText(GUIEditor_Edit[4],'') local clear5 = guiSetText(GUIEditor_Edit[5],'') local clear6 = guiSetText(GUIEditor_Edit[6],'') if clear1 and clear2 and clear3 and clear4 and clear5 and clear6 then outputChatBox("fields cleared succesfely", getLocalPlayer()) end elseif source == GUIEditor_Button[2] then if guiGetText(GUIEditor_Edit[1]) ~= '' and guiGetText(GUIEditor_Edit[2]) ~= '' and guiGetText(GUIEditor_Edit[3]) ~= '' and guiGetText(GUIEditor_Edit[4]) ~= '' and guiGetText(GUIEditor_Edit[5]) ~= '' and guiGetText(GUIEditor_Edit[6]) ~= '' then triggerServerEvent("get:Fields", localPlayer, guiGetText(GUIEditor_Edit[1]), guiGetText(GUIEditor_Edit[2]), guiGetText(GUIEditor_Edit[3]), guiGetText(GUIEditor_Edit[4]), guiGetText(GUIEditor_Edit[5]), guiGetText(GUIEditor_Edit[6])) end elseif source == GUIEditor_Button[1] then local x, y, z = getElementPosition(getLocalPlayer()) guiSetText(GUIEditor_Edit[1], x) guiSetText(GUIEditor_Edit[2], y) guiSetText(GUIEditor_Edit[3], z) end end ) addEvent("get:Values",true) addEventHandler("get:Values", root, function( nameID, state ) if nameID and state then local row = guiGridListAddRow( GUIEditor_Grid[1] ) guiGridListSetItemText(GUIEditor_Grid[1], row, CNameID, nameID, false, false) guiGridListSetItemText(GUIEditor_Grid[1], row, CState, state, false, false) end end ) Link to comment
iFoReX Posted June 24, 2012 Author Share Posted June 24, 2012 the files in XML was sent, but the gridlist doesnt edit 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