Jump to content

Need some help


tim260

Recommended Posts

Posted

so i have been reading the wiki lately and i stumbled acros : guiCreateGridList

I dont understand the examples very good so can someone send me an example ( not the one from the wiki wich i dont understand very well )

What i want to do is create xml files and do f.e. something like in the code below

helppages = { 
"helppage1.xml", 
"page2.xml", 
"page3.xml" 

and then the xml wiles would look like this :

<article name> </article name> 
 <content></content> 

if your understanding it im trying to implant that in an F1 help panel.

Thanks for reading

Posted
  
            local xml1 = xmlLoadFile( "page.xml" ) 
            local contents1 = xmlNodeGetValue( xml1 ) 
    guiCreateGridList(0.03,0.03,0.94,0.95,contents1,true,page) 
  

You mean like this?

Posted (edited)
local pages = 
{ 
    "helppage1.xml", 
    "page2.xml", 
    "page3.xml" 
} 
  
GridList = guiCreateGridList ( pX, pY, wX, hY, false ) 
column1 = guiGridListAddColumn ( GridList, "Help", 1.0 ) 
column2 = guiGridListAddColumn ( GridList, "Page 2", 1.0 ) 
column3 = guiGridListAddColumn ( GridList, "Page 3", 1.0 ) 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        for index, page in pairs">pairs ( pages ) do 
            local loadFiles = xmlCreateFile ( page, "content" ) 
            local newChild = xmlCreateChild ( loadFiles, "article name" ) 
            xmlSaveFile ( loadFiles ) 
             
            row = guiGridListAddRow ( column1 ) 
            row2 = guiGridListAddRow ( column2 ) 
            row3 = guiGridListAddRow ( column3 ) 
             
            if ( row and row2 and row3 and column1 and column2 and column3 ) then 
                local file1 = xmlLoadFile ( "helppage1.xml" ) 
                local file2 = xmlLoadFile ( "page2.xml" ) 
                local file3 = xmlLoadFile ( "page3.xml" ) 
                 
                if ( file1 and file2 and file3 ) then 
                    local node = xmlFindChild ( file1, "article name", 0 ) 
                    local text1 = xmlNodeGetValue ( node1 ) 
                     
                    local node2 = xmlFindChild ( file2, "article name", 0 ) 
                    local text2 = xmlNodeGetValue ( node2 ) 
                     
                    local node3 = xmlFindChild ( file3, "article name", 0 ) 
                    local text3 = xmlNodeGetValue ( node3 ) 
                    guiGridListSetItemText ( GridList, row, column1, text1, false, false ) 
                    guiGridListSetItemText ( GridList, row2, column2, text2, false, false ) 
                    guiGridListSetItemText ( GridList, row3, column3, text3, false, false ) 
                end 
            end 
        end 
    end 
) 

Try it :S Remember, change gridlist positions...

Edited by Guest

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

@Draken: That script make's no sense, you're setting the text of the rows with the return of xmlLoadFile which isn't the content of course.

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 can't use numbers as variable names.

You should test what you post.

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

I can't test now :S Anyway I will try to solve this shit..

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted
You can't use numbers as variable names, it'll get error.

Why post again lol Solidsnake said..

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

f.e. i have this GUI how would i use it to add items to that

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Grid = {} 
  
        GUIEditor_Window[1] = guiCreateWindow(379,234,319,417,"Construction Panel",false) 
        guiSetAlpha(GUIEditor_Window[1],1) 
        GUIEditor_Grid[1] = guiCreateGridList(18,28,287,293,false,GUIEditor_Window[1]) 
        guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
        guiGridListAddColumn(GUIEditor_Grid[1],"Items",0.2) 
        
    end 
) 

Posted

Use:

guiGridListAddRow and guiGridListSetItemText 

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.

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