Jump to content

mtarainbow

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by mtarainbow

  1. 2 gb ram 2.1 ghz CPU that script.. addEvent("sortTopclans", true) addEventHandler("sortTopclans", root, function() triggerClientEvent("returnTopclans", source, loadall("wins")) end) function loadall (datatype) local root = xmlLoadFile ("DataBase.xml") if (root) then local usersNode = xmlFindChild (root,"user",0) if (usersNode) then local allPlayers = xmlNodeGetChildren(usersNode) allPlayersData = {} nrDD = 0 nrDM = 0 for i,data in ipairs(allPlayers) do if datatype == "achievements" then AchCount = 0 for j=1,#AchievementsName do local ac = tonumber(xmlNodeGetAttribute (data,"ac"..j.."")) if ac == 1 then AchCount = AchCount + 1 end end local playerName = xmlNodeGetAttribute (data,"playerName") allPlayersData[i] = {pName = playerName or "???",dType = AchCount or 0} elseif datatype == "ddratio" then local played = tonumber(xmlNodeGetAttribute (data,"mapsPlayedDD")) or 0 local wins = tonumber(xmlNodeGetAttribute (data,"mapsWonDD")) or 0 local ratio = 0 if played == 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins ~= 0 then ratio = (100/played)*wins elseif wins > played then ratio = 0 end if played >= 100 then nrDD = nrDD + 1 local playerName = xmlNodeGetAttribute (data,"playerName") allPlayersData[nrDD] = {pName = playerName or "???",dType = ratio or 0} end elseif datatype == "dmratio" then local played = tonumber(xmlNodeGetAttribute (data,"mapsPlayedDM")) or 0 local wins = tonumber(xmlNodeGetAttribute (data,"mapsWonDM")) or 0 local ratio = 0 if played == 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins ~= 0 then ratio = (100/played)*wins elseif wins > played then ratio = 0 end if played >= 100 then nrDM = nrDM + 1 local playerName = xmlNodeGetAttribute (data,"playerName") allPlayersData[nrDM] = {pName = playerName or "???",dType = ratio or 0} end else local playerData = tonumber(xmlNodeGetAttribute (data,datatype)) local playerName = xmlNodeGetAttribute (data,"nick") local playerKill = xmlNodeGetAttribute (data,"kills") allPlayersData[i] = {pName = playerName or "???",dType = playerData or 0 ,pKill = playerKill or 0} end end xmlUnloadFile (root) return allPlayersData end end end
  2. I have a large database and the database lag(network trouble) occurs when I tabled. How can I solve this?
×
×
  • Create New...