Castillo Posted June 27, 2013 Posted June 27, 2013 Do you get errors on the debugscript? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted June 27, 2013 Posted June 27, 2013 Are you sure? are the coordinates valid? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
squar Posted June 27, 2013 Author Posted June 27, 2013 (edited) Solved. Edited June 27, 2013 by Guest
Castillo Posted June 27, 2013 Posted June 27, 2013 After this line: local colX, colY, colZ, colSize, model, posX, posY, posZ, rotX, rotY, rotZ, team, moveSpeed, moveX, moveY, moveZ = unpack(v) Put: local colX, colY, colZ, colSize, model, posX, posY, posZ, rotX, rotY, rotZ, team, moveSpeed, moveX, moveY, moveZ = unpack(v) outputChatBox ( tostring ( posX ) ..", ".. tostring ( posY ) ..", ".. tostring ( posZ ) ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
squar Posted June 27, 2013 Author Posted June 27, 2013 It outputs nothing, it needs to be triggered i think
Castillo Posted June 27, 2013 Posted June 27, 2013 Before: for i,v in ipairs(gates) do put: outputChatBox ( "TOTAL GATES: ".. #gates ) for i,v in ipairs(gates) do San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
squar Posted June 27, 2013 Author Posted June 27, 2013 It says TOTAL GATES: 0, then 5 sec later the XML is loaded. As you see i used setTimer on 5 sec.
Castillo Posted June 27, 2013 Posted June 27, 2013 local gates = {} function gatesLoad() setTimer(function() local xmlNode = xmlLoadFile("gates.xml") if not xmlNode then outputDebugString("Invalid xml file") return end local children = xmlNodeGetChildren(xmlNode) for k, node in ipairs(children) do if xmlNodeGetName(node) == "gate" then local colX, colY, colZ, colSize = tonumber(xmlNodeGetAttribute(node, "colX")), tonumber(xmlNodeGetAttribute(node, "colY")), tonumber(xmlNodeGetAttribute(node, "colZ")), tonumber(xmlNodeGetAttribute(node, "colSize")) local model, posX, posY, posZ = tonumber(xmlNodeGetAttribute(node, "model")), tonumber(xmlNodeGetAttribute(node, "posX")), tonumber(xmlNodeGetAttribute(node, "posY")), tonumber(xmlNodeGetAttribute(node, "posZ")) local rotX, rotY, rotZ = tonumber(xmlNodeGetAttribute(node, "rotX")),tonumber(xmlNodeGetAttribute(node, "rotY")),tonumber(xmlNodeGetAttribute(node, "rotZ")) local team, moveSpeed, moveX, moveY, moveZ = tonumber(xmlNodeGetAttribute(node, "teamLock")), tonumber(xmlNodeGetAttribute(node, "moveSpeed")), tonumber(xmlNodeGetAttribute(node, "moveX")), tonumber(xmlNodeGetAttribute(node, "moveY")), tonumber(xmlNodeGetAttribute(node, "moveZ")) table.insert(gates, {colX, colY, colZ, colSize, model, posX, posY, posZ, rotX, rotY, rotZ, team, moveSpeed, moveX, moveY, moveZ}) end end outputDebugString("Gates successfully loaded") for i,v in ipairs(gates) do local colX, colY, colZ, colSize, model, posX, posY, posZ, rotX, rotY, rotZ, team, moveSpeed, moveX, moveY, moveZ = unpack(v) local col = createColSphere(colX,colY,colZ,colSize) local gate = createObject(model,posX,posY,posZ,rotX,rotY,rotZ) --setElementVisibleTo(col,getRootElement (),false) addEventHandler("onColShapeHit", col, function(hitElement) local theTeam = getPlayerTeam(hitElement) if not theTeam then return end if (getTeamName(theTeam) == "Staff") then moveObject(gate,moveSpeed,moveX,moveY,moveZ, 0, 0, 0) end end ) addEventHandler("onColShapeLeave", col, function(leaveElement) local theTeam2 = getPlayerTeam(leaveElement) if not theTeam2 then return end if (getTeamName(theTeam2) == "Staff") then moveObject(gate,moveSpeed,posX,posY,posZ, 0, 0, 0) end end ) end end , 5000, 1) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), gatesLoad) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted June 27, 2013 Posted June 27, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now