Jump to content

xml and memo


Stevenn

Recommended Posts

Posted

well, I've got a problem i'm trying to set the memo text using a .xml file

local Rules = xmlLoadFile ( "xml/rules.xml" )  
local Ruless = xmlNodeGetValue ( Rules )  
  
window = guiCreateWindow(462,275,716,474,"",false) 
Rules = guiCreateButton(13,76,82,35,"Rules",false,window) 
memo = guiCreateMemo(117,29,582,386,"",false,window) 
  
function buttonClick(button) 
    if (button) ~= "left" then return end 
    if (source == Rules) then 
        guiSetText(memo, tostring(Ruless)) 
    end 
end 
addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) 

the file rules.xml inside the xml folder:

<Ruless> 
My rules here 
</Ruless> 

"Bad arguement at line: 2"

Posted (edited)
local rules = xmlLoadFile ( 'xml/rules.xml' ) 
  
window = guiCreateWindow(462,275,716,474,"",false) 
Rules = guiCreateButton(13,76,82,35,"Rules",false,window) 
memo = guiCreateMemo(117,29,582,386,"",false,window) 
  
addEventHandler ( 'onClientGUIClick', root, 
    function ( ) 
        if ( source == Rules ) then 
             guiSetText ( memo, tostring ( xmlNodeGetValue ( rules ) ) ) 
        end 
    end 
) 

Edited by Guest

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

-- script:

local Rules = xmlLoadFile ( "xml/rules.xml" ) 
local Ruless = xmlNodeGetValue ( Rules ) 
  
window = guiCreateWindow(462,275,716,474,"",false) 
Rules = guiCreateButton(13,76,82,35,"Rules",false,window) 
memo = guiCreateMemo(117,29,582,386,"",false,window) 
  
function buttonClick ( button ) 
    if ( button ~= "left" ) then  
        return  
    end 
     
    if ( source == Rules ) then 
        guiSetText ( memo, tostring ( Ruless ) ) 
    end 
end 
addEventHandler ( "onClientGUIClick", resourceRoot, buttonClick ) 

-- rules.xml

    My rules here 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Solidsnake14, your code is wrong.

nope it works i just forgot to add it into the meta.xml :)

:lol: I've seen wrong then.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted
Solidsnake14, your code is wrong.

nope it works i just forgot to add it into the meta.xml :)

:lol: I've seen wrong then.

actually, mine worked too :P

Posted
Solidsnake14, your code is wrong.

It's not wrong, but yours is wrong. I clicked on "Rules" button and it didn't load the text from the XML file.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Solidsnake14, your code is wrong.

It's not wrong, but yours is wrong. I clicked on "Rules" button and it didn't load the text from the XML file.

I know, I've seen fast and wrong.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

You shouldn't say someone else code is wrong when you haven't even tested it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
You shouldn't say someone else code is wrong when you haven't even tested it.

I need sleep dude xD

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

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