Jump to content

How i can export xml list?[SOLVED]


Recommended Posts

What do you mean by "export"? List them out? Use XML functions in Lua.

In freeroam exported this list, but I have not found how.

upgrades.xml (admin\conf):


  "1000" name="Pro" />
  "1001" name="Win" />
  "1002" name="Drag" />
  "1003" name="Alpha" />
  "1004" name="Champ scoop" />
  "1005" name="Fury scoop" />
  "1006" name="Roof scoop" />
  "1007" name="Side skirt Left" />
  "1008" name="Nitro 5x" />
  "1009" name="Nitro 2x" />
  "1010" name="Nitro 10x" />
  "1011" name="Race scoop" />
  "1012" name="Worx scoop" />
  "1013" name="Round fog lamps" />
  "1014" name="Champ" />
  "1015" name="Race" />
  "1016" name="Worx" />
  "1017" name="Side skirt Right" />
  "1018" name="Upswept" />
  "1019" name="Twin" />
  "1020" name="Large" />
  "1021" name="Medium" />
  "1022" name="Small" />
  "1023" name="Fury" />
  "1024" name="Square fog lamps" />
  "1025" name="Offroad" />
  "1026" name="Side skirt Left (Alien)" />
  "1027" name="Side skirt Right (Alien)" />
  "1028" name="Exhaust (Alien)" />
  "1029" name="Exhaust (X-flow)" />
  "1030" name="Side skirt Right (X-flow)" />
  "1031" name="Side skirt Left (X-flow)" />
  "1032" name="Roof vent (Alien)" />
  "1033" name="Roof vent (X-flow)" />
  "1034" name="Side skirt Right (Alien)" />
  "1035" name="Side skirt Left (Alien)" />
  "1036" name="Exhaust (Alien)" />
  "1037" name="Exhaust (X-flow)" />
  "1038" name="Side skirt Right (X-flow)" />
  "1039" name="Side skirt Left (X-flow)" />
  "1040" name="Roof vent (Alien)" />
  "1041" name="Roof vent (X-flow)" />
  "1042" name="Side skirt Left (Chrome strip)" />
  "1043" name="Exhaust (Slamin)" />
  "1044" name="Exhaust (Chromer)" />
  "1045" name="Side skirt Right (Alien)" />
  "1046" name="Side skirt Left (Alien)" />
  "1047" name="Exhaust (Alien)" />
  "1048" name="Exhaust (X-flow)" />
  "1049" name="Side skirt Right (X-flow)" />
  "1050" name="Side skirt Left (X-flow)" />
  "1051" name="Roof vent (Alien)" />
  "1052" name="Roof vent (X-flow)" />
  "1053" name="Spoiler (Alien)" />
  "1054" name="Spoiler (X-flow)" />
  "1055" name="Side skirt Right (Alien)" />
  "1056" name="Side skirt Left (Alien)" />
  "1057" name="Exhaust (Alien)" />
  "1058" name="Exhaust (X-flow)" />
  "1059" name="Side skirt Right (X-flow)" />
  "1060" name="Side skirt Left (X-flow)" />
  "1061" name="Roof vent (Alien)" />
  "1062" name="Roof vent (X-flow)" />
  "1063" name="Spoiler (Alien)" />
  "1064" name="Spoiler (X-flow)" />
  "1065" name="Side skirt Right (Alien)" />
  "1066" name="Side skirt Left (Alien)" />
  "1067" name="Exhaust (Alien)" />
  "1068" name="Exhaust (X-flow)" />
  "1069" name="Side skirt Right (X-flow)" />
  "1070" name="Side skirt Left (X-flow)" />
  "1071" name="Roof vent (Alien)" />
  "1072" name="Roof vent (X-flow)" />
  "1073" name="Shadow" />
  "1074" name="Mega" />
  "1075" name="Rimshine" />
  "1076" name="Wires" />
  "1077" name="Classic" />
  "1078" name="Twist" />
  "1079" name="Cutter" />
  "1080" name="Switch" />
  "1081" name="Grove" />
  "1082" name="Import" />
  "1083" name="Dollar" />
  "1084" name="Trance" />
  "1085" name="Atomic" />
  "1086" name="Stereo bass boost" />
  "1087" name="Hydralics" />
  "1088" name="Side skirt Right (Alien)" />
  "1089" name="Side skirt Left (Alien)" />
  "1090" name="Exhaust (Alien)" />
  "1091" name="Exhaust (X-flow)" />
  "1092" name="Side skirt Right (X-flow)" />
  "1093" name="Side skirt Left (X-flow)" />
  "1094" name="Roof vent (Alien)" />
  "1095" name="Roof vent (X-flow)" />
  "1096" name="Ahab" />
  "1097" name="Virtual" />
  "1098" name="Access" />
  "1100" name="Bullbar (Chrome grill)" />
  "1101" name="Side skirt Right (Chrome flames)" />
  "1102" name="Side skirt Left (Chrome strip)" />
  "1103" name="Roof (Convertible roof)" />
  "1104" name="Exhaust (Chromer)" />
  "1105" name="Exhaust (Slamin)" />
  "1106" name="Side skirt Left (Chrome arches)" />
  "1107" name="Side skirt Right (Chrome strip)" />
  "1108" name="Side skirt Left (Chrome strip)" />
  "1109" name="Rear bullbars (Chromer)" />
  "1110" name="Rear bullbars (Slamin)" />
  "1111" name="Unknown" />
  "1112" name="Unknown" />
  "1113" name="Exhaust (Chromer)" />
  "1114" name="Exhaust (Slamin)" />
  "1115" name="Front bullbars (Chromer)" />
  "1116" name="Front bullbars (Slamin)" />
  "1117" name="Front bumper (Chromer)" />
  "1118" name="Side skirt Left (Chrome trim)" />
  "1119" name="Side skirt Left (Wheelcovers)" />
  "1120" name="Side skirt Right (Chrome trim)" />
  "1121" name="Side skirt Right (Wheelcovers)" />
  "1122" name="Side skirt Left (Chrome flames)" />
  "1123" name="Bullbar (Chrome bars)" />
  "1124" name="Side skirt Right (Chrome arches)" />
  "1125" name=
Link to comment
I still don't understand what you want... that list is a list of vehicle upgrades. id is the ID of the upgrade (Vehicle Upgrades) and there is also its name. If you want to use that file in another resource use path: ":admin/conf/upgrades.xml"

F1 -> Upgrade -> GUI opens with elements of tuning.

The question is how this list is exported?

I exported it differently. But it's probably too long process. How can I make it easier? And how can I compare the allowed ID tuning to filter them? (The code is not completed yet (func cs ()))

Sorry for the translation.

local vehicleUpgrades = { id = { }, name = { } } 
  
function loadItems( ) 
for k, i in ipairs( xmlNodeGetChildren( xmlLoadFile( "ups.xml" ) ) ) do 
    vehicleUpgrades.id[k] = xmlNodeGetAttribute( i, "id" ) 
    vehicleUpgrades.name[k] = xmlNodeGetAttribute( i, "name" ) 
end 
end 
addEventHandler( 'onResourceStart', resourceRoot, loadItems ) 
  
function cs(thePlayer) 
local theVehicle = getPedOccupiedVehicle( thePlayer ) 
local tabVEH = getVehicleCompatibleUpgrades ( theVehicle ) 
for _, k in pairs (tabVEH) do 
    for j=1, #tabVEH do 
    outputDebugString( vehicleUpgrades.id[j] .. ' ' .. tostring(k) ) 
        if vehicleUpgrades.id[j] == tostring(k) then 
            outputChatBox( vehicleUpgrades.name[j] ) 
        end 
    end 
end 
end 
addCommandHandler('c', cs) 

Link to comment
By call/exporting the table.

https://wiki.multitheftauto.com/wiki/Call

Just the same as calling functions.

You mean export to another resource or export to another file?

Export another file from another resource. (Too costly to disassemble foreign code.)

meta.xml (admin):

    --Exported Functions--> 
    function="getPlayerCountry" /> 

I redid everything is different, I would like to get an answer: How to make reasonable to make it work well?

viewtopic.php?f=91&t=75817&p=697320#p697310

Link to comment
  • Moderators

Just get all the data from the xml and save it in a table. Then send the table and it works well...

If this isn't the answer you are waiting for, then rewrite your question, because it isn't giving enough information about the problem you have.

"But it's probably too long process."

Lua functions are very fast you don't have to worry about a few loops.

And if you are still not sure about that you can use getTickCount() to check your code speed.

Link to comment
Just get all the data from the xml and save it in a table. Then send the table and it works well...

If this isn't the answer you are waiting for, then rewrite your question, because it isn't giving enough information about the problem you have.

"But it's probably too long process."

Lua functions are very fast you don't have to worry about a few loops.

And if you are still not sure about that you can use getTickCount() to check your code speed.

One algorithm can run fast, but if more than one, it could lead to delays in the work.

Now my problem in compiling the search algorithm identical figures of two tables. Can you help me?

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