ahmedo01 Posted August 12, 2014 Share Posted August 12, 2014 GUIEditor = { label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() vehiclespawnermanager = guiCreateWindow(419, 203, 463, 361, "Vehicle Spawner Manager", false) guiWindowSetSizable(vehiclespawnermanager, false) spawnerlist = guiCreateGridList(9, 29, 162, 322, false, vehiclespawnermanager) guiGridListAddColumn(spawnerlist, "Spawners", 0.9) for i = 1, 2 do guiGridListAddRow(spawnerlist) end guiGridListSetItemText(spawnerlist, 0, 1, "-", false, false) guiGridListSetItemText(spawnerlist, 1, 1, "-", false, false) x = guiCreateEdit(240, 53, 46, 19, "", false, vehiclespawnermanager) y = guiCreateEdit(321, 53, 46, 19, "", false, vehiclespawnermanager) z = guiCreateEdit(402, 53, 46, 19, "", false, vehiclespawnermanager) GUIEditor.label[1] = guiCreateLabel(377, 55, 15, 17, "Z:", false, vehiclespawnermanager) GUIEditor.label[2] = guiCreateLabel(296, 55, 15, 17, "Y:", false, vehiclespawnermanager) GUIEditor.label[3] = guiCreateLabel(215, 55, 15, 17, "X:", false, vehiclespawnermanager) dumpcurrentposition = guiCreateButton(270, 30, 173, 15, "Dump Current Position", false, vehiclespawnermanager) GUIEditor.label[4] = guiCreateLabel(216, 85, 101, 19, "Restricted Team:", false, vehiclespawnermanager) restrictedteam = guiCreateEdit(320, 85, 128, 19, "", false, vehiclespawnermanager) GUIEditor.label[5] = guiCreateLabel(216, 113, 101, 15, "Spawner Name:", false, vehiclespawnermanager) spawnername = guiCreateEdit(320, 109, 128, 19, "", false, vehiclespawnermanager) GUIEditor.label[6] = guiCreateLabel(215, 147, 15, 17, "R:", false, vehiclespawnermanager) r = guiCreateEdit(240, 147, 46, 19, "", false, vehiclespawnermanager) GUIEditor.label[7] = guiCreateLabel(296, 147, 15, 17, "G:", false, vehiclespawnermanager) g = guiCreateEdit(321, 147, 46, 19, "", false, vehiclespawnermanager) GUIEditor.label[8] = guiCreateLabel(377, 147, 15, 17, "B:", false, vehiclespawnermanager) b = guiCreateEdit(402, 147, 46, 19, "", false, vehiclespawnermanager) addspawner = guiCreateButton(380, 189, 73, 45, "Add Spawner", false, vehiclespawnermanager) cancel = guiCreateButton(380, 244, 73, 45, "Cancel", false, vehiclespawnermanager) reset = guiCreateButton(380, 299, 73, 45, "Reset", false, vehiclespawnermanager) vehiclelist = guiCreateGridList(208, 194, 153, 157, false, vehiclespawnermanager) guiGridListAddColumn(vehiclelist, "Vehicle List", 0.9) guiGridListSetSelectionMode ( vehiclelist, 1 ) guiSetVisible(vehiclespawnermanager, false) --Vehicles vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } for v = 1,211 do guiGridListAddRow(vehiclelist) end for id,number in ipairs(vehicleIDS) do modelname = getVehicleNameFromModel ( number ) guiGridListSetItemText(vehiclelist, id, 1, modelname, false, false) end --Button Funcs addEventHandler ( "onClientGUIClick", reset, function() guiSetText ( x, "" ) guiSetText ( y, "" ) guiSetText ( z, "" ) guiSetText ( r, "" ) guiSetText ( g, "" ) guiSetText ( b, "" ) guiSetText ( restrictedteam, "" ) guiSetText ( spawnername, "" ) end , false ) addEventHandler ( "onClientGUIClick", cancel, function() guiSetVisible(vehiclespawnermanager, false) showCursor(false) end , false ) addEventHandler ( "onClientGUIClick", dumpcurrentposition, function() local ,yd,zd = getElementPosition( getLocalPlayer() ) guiSetText ( x, ) guiSetText ( y, yd ) guiSetText ( z, zd ) end , false ) --Add Function addEventHandler ( "onClientGUIClick", addspawner, function() xt = guiGetText(x) yt = guiGetText(y) zt = guiGetText(z) restrictedteamt = guiGetText(restrictedteam) spawnernamet = guiGetText(spawnername) rt = guiGetText(r) gt = guiGetText(g) bt = guiGetText(b) if not xt == false and not yt == false and not zt == false and not restrictedteamt == false and not spawnernamet == false and not rt == false and not gt == false and not bt == false then xml = xmlLoadFile( "spawners.xml" ) if (xml) then child = xmlCreateChild( xml, "spawner" ) if (child) then xmlNodeSetAttribute( child, "spawnername", spawnernamet ) xmlNodeSetAttribute( child, "restrictedteam", restrictedteamt ) xmlNodeSetAttribute( child, "x", xt ) xmlNodeSetAttribute( child, "y", yt ) xmlNodeSetAttribute( child, "z", zt ) xmlNodeSetAttribute( child, "r", rt ) xmlNodeSetAttribute( child, "g", gt ) xmlNodeSetAttribute( child, "b", bt ) outputChatBox("Created vehicle marker: X: "..xt.." Y: "..yt.." Z: "..zt) sa = xmlSaveFile( xml ) xmlUnloadFile( xml ) spawnern = xmlNodeGetAttribute( child, "spawnername" ) outputDebugString( spawnern, 3, 255, 255, 255) if sa == true then outputDebugString( "saved file" ) end end end end end , false) end ) addCommandHandler("as", function() guiSetVisible(vehiclespawnermanager, true) showCursor(true) end ) xml functions not working in client side or its my wrong. please help. Link to comment
ahmedo01 Posted August 12, 2014 Author Share Posted August 12, 2014 :110 Bad argument @ 'xmlNodeGetAttribute' [Expected xml-node at argument 1] :111 Bad argument @ 'outputDebugString' got boolean at argument 1 Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 spawnern = xmlNodeGetAttribute( child, "spawnername" ) Put this above: sa = xmlSaveFile( xml ) xmlUnloadFile( xml ) Link to comment
ahmedo01 Posted August 12, 2014 Author Share Posted August 12, 2014 i know but this not saves xml file. i have xml file but not add child. <spawner> </spawner> only this Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 xt = guiGetText(x) yt = guiGetText(y) zt = guiGetText(z) restrictedteamt = guiGetText(restrictedteam) spawnernamet = guiGetText(spawnername) rt = guiGetText(r) gt = guiGetText(g) bt = guiGetText(b) What does these return in outputChatBox(tostring(...)) ? Link to comment
ahmedo01 Posted August 12, 2014 Author Share Posted August 12, 2014 i asking why not save xml Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 I totally don't understand it anymore now. Does it save or not? Does it set the attributes or not? Link to comment
Max+ Posted August 12, 2014 Share Posted August 12, 2014 (edited) - Edited August 12, 2014 by Guest Link to comment
ahmedo01 Posted August 12, 2014 Author Share Posted August 12, 2014 thanks Et-win i am fixed it. i am converting to mysql. Link to comment
ahmedo01 Posted August 12, 2014 Author Share Posted August 12, 2014 i have a question. dbExec( conn, "SELECT spawnername FROM `ogren` . `spawners`") i can select spawnername from table but how i can get spawnername? 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