Jump to content

just a question


mjau

Recommended Posts

Posted

Hi i have almost never worked with xml before just some descriptions for a spawnmenu but today i tought i should learn more about it

so i have a housecreator GUI

wich functions in what order i need to make a xml line exactly like this?

"" markerPosY="" markerPosZ="" owner="" /> 

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

TO CREATE A FILE :

xmlFile= xmlCreateFile ( "YOURXML.xml", "root" ) -- Create the xml file  
xmlHouses = xmlCreateChild ( xmlFile, "house") -- CREATE THE  TAG 
xmlNodeSetAttribute(xmlHouses,"markerPosX", "VALUE1") -- CREATE THE MARKERPOSX PART 
xmlNodeSetAttribute(xmlHouses,"markerPosY", "VALUE2") -- SAME WITH Y 
xmlNodeSetAttribute(xmlHouses,"markerPosZ", "VALUE3") -- SAME WITH Z 
xmlNodeSetAttribute(xmlHouses,"owner", "VALUE4") -- SAME WITH OWNER 
  
  

TO GET THE X,Y,Z, OWNER :

posX = xmlNodeGetAttribute(xmlFile, "markerPosX") 
posY = xmlNodeGetAttribute(xmlFile, "markerPosY") 
posZ = xmlNodeGetAttribute(xmlFile, "markerPosZ") 
owner = xmlNodeGetAttribute(xmlFile, "owner") 
outputChatBox("X : "..posX.." Y : "..posY.." Z : "..posZ.." Owner : "..owner) 
  

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted (edited)

Better

Server

do 
    local house = getElementsByType( "house" ) 
    if #house > 0 then 
        for _,v in pairs( house ) do 
            mark = createMarker( 
                getElementData( v,"markerPosX" ), 
                getElementData( v,"markerPosY" ), 
                getElementData( v,"markerPosZ" ) 
            ) 
            setElementData( mark,"owner",getElementData( v,"owner" ) ) 
        end 
    end  
end 

<map> 
    <house markerPosX="0" markerPosY="0" markerPosZ="10" owner="some" /> 
</map> 
  

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

Because house is element and you can get data.

But it only in map file.

So add to meta.xml

<map src="some.map" /> 

<map> 
    <house markerPosX="0" markerPosY="0" markerPosZ="10" owner="some" /> 
</map> 

I test it now.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

Xthepromise i know how to create the file i just wanted a way to create that line for my houseSystem... anyway tnx

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

Kenix Ah, you mean you create it via a map file and get the elementdata by the type.

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

well mySQL is too hard for me read JR10 tut and things but i dont understand it so i wanted to do it with XML since i understand it better

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

another question

how can i loop trough all the house childrens in the file and create a housepickup at the positions ?

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
for i,v in ipairs(xmlNodeGetChildren(xmlFile)) 
xmlNodeGetAttribute(xmlFile, v) 
end 

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

What ? how do i create the pickup at the cordinates ?

this doesent return x y and z pos ?

im making a function to create a housepickup at every house saved in my xml file....

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
xmlFile = xmlLoadFile("XML.xml") 
for i,v in ipairs(xmlNodeGetChildren(xmlFile)) 
posX = xmlNodeGetAttribute(xmlFile, "markerPosX") 
posY = xmlNodeGetAttribute(xmlFile, "markerPosY") 
posZ = xmlNodeGetAttribute(xmlFile, "markerPosZ") 
owner = xmlNodeGetAttribute(xmlFile, "owner") 
outputChatBox("X : "..posX.." Y : "..posY.." Z : "..posZ.." Owner : "..owner) 
end 

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

why this dont work

says bad argument at create pickp line

function reloadHouses() 
file = xmlLoadFile("XML/houseData.xml") 
for i,v in ipairs(xmlNodeGetChildren(file)) do 
posX = xmlNodeGetAttribute(file, "markerPosX") 
posY = xmlNodeGetAttribute(file, "markerPosY") 
posZ = xmlNodeGetAttribute(file, "markerPosZ") 
owner = xmlNodeGetAttribute(file, "owner") 
houseIcon = createPickup(posX, posY, posZ, 3, 1273, 1000) 
end 
end 

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
function reloadHouses() 
file = xmlLoadFile("XML/houseData.xml") 
for i,v in ipairs(xmlNodeGetChildren(file)) do 
posX = xmlNodeGetAttribute(v, "markerPosX") 
posY = xmlNodeGetAttribute(v, "markerPosY") 
posZ = xmlNodeGetAttribute(v, "markerPosZ") 
owner = xmlNodeGetAttribute(v, "owner") 
houseIcon = createPickup(posX, posY, posZ, 3, 1273, 1000) 
end 
end 

Sorry my error :D

You have to replace the file in the for tags with v.

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%

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