Jump to content

Load gridlist items from file


NimaGame

Recommended Posts

Hi.My cod is this:

addCommandHandler( "kharidghors", 
    function() 
        Panjere = guiCreateWindow(541, 212, 255, 256, "Kharid Ghors", false) 
        guiWindowSetSizable(Panjere, false) 
        guiSetProperty(Panjere, "CaptionColour", "FF0D8004") 
        guiSetVisible(Panjere, true) 
        showCursor(true) 
        guiSetInputEnabled(true) 
        Bekhar = guiCreateButton(10, 169, 114, 72, "Kharid", false, Panjere) 
        guiSetProperty(Bekhar, "NormalTextColour", "FF0452F0") 
        Nakhar = guiCreateButton(131, 169, 114, 72, "Bashe Badan!", false, Panjere) 
        guiSetProperty(Nakhar, "NormalTextColour", "FFFF0000") 
        Ghors = guiCreateGridList(9, 25, 236, 139, false, Panjere) 
        guiGridListAddColumn(Ghors, "Ghors", 0.5) 
        guiGridListAddColumn(Ghors, "Gheymat", 0.5) 
        for i = 1, 5 do 
            guiGridListAddRow(Ghors) 
        end 
        guiGridListSetItemText(Ghors, 0, 1, "Ghors - 1 Adad", false, false) 
        guiGridListSetItemText(Ghors, 0, 2, "50 $", false, false) 
        guiGridListSetItemText(Ghors, 1, 1, "Ghors - 2 Adad", false, false) 
        guiGridListSetItemText(Ghors, 1, 2, "100 $", false, false) 
        guiGridListSetItemText(Ghors, 2, 1, "Ghors - 3 Adad", false, false) 
        guiGridListSetItemText(Ghors, 2, 2, "150 $", false, false) 
        guiGridListSetItemText(Ghors, 3, 1, "Ghors - 4 Adad", false, false) 
        guiGridListSetItemText(Ghors, 3, 2, "200 $", false, false) 
        guiGridListSetItemText(Ghors, 4, 1, "Ghors - 5 Adad", false, false) 
        guiGridListSetItemText(Ghors, 4, 2, "250 $", false, false)     
    end 
) 

I wan't to load items from a file.

How i can do this?

[File Is On SERVER]

Link to comment

Well, you should trigger a server side event which would then trigger a client side event sending the items.

Functions you need to use:

triggerServerEvent 
addEvent 
addEventHandler 
triggerClientEvent 

If by from a file you mean a XML file, then you must also use:

xmlLoadFile 
xmlNodeGetChildren 
xmlNodeGetAttribute 
xmlUnloadFile 

Link to comment

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