Sex* Posted February 14, 2013 Share Posted February 14, 2013 I have thsi userpanel that doesnt have alot of debug errors but it lags so much that other peoples with better PC-s are crashing then this resource is working. How can i fix this and why is it so laggy? Link to comment
50p Posted February 14, 2013 Share Posted February 14, 2013 It depends what is in the script. Simple GUI shouldn't lag. Maybe you have some other resource which uses a render event that may slow down their fps. On my very old PC, it took about 1-2 seconds before I could open admin panel the first time but that panel is full of ui elements and when I hid it and reopened it was fine. It only happened at creation of GUI. Link to comment
Sex* Posted February 14, 2013 Author Share Posted February 14, 2013 Ah already got an answer from another scripter who has the same userpanel. Problem is in loadplayerdata and saveplayerdata so how could i fix this problem so it would work without problems? Link to comment
50p Posted February 14, 2013 Share Posted February 14, 2013 I don't have that script and I'm sure there are other people here who can help you with that. Speaking to the author of the resource would be the best idea, so that he can fix it and release a new fixed version. Link to comment
Sex* Posted February 14, 2013 Author Share Posted February 14, 2013 I don't have that script and I'm sure there are other people here who can help you with that. Speaking to the author of the resource would be the best idea, so that he can fix it and release a new fixed version. Ok, the loadplayerdata and saveplayerdata some parts, actually all the script has loadplayerdata and saveplayerdata in everything.: function newLevelSystem(thePlayer) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) if not (playerLevel == 41) then if (playerCash >= levelPrices[playerLevel+1]) then savePlayerData(thePlayer,"cash",playerCash-levelPrices[playerLevel+1]) savePlayerData(thePlayer,"level",playerLevel+1) if (playerLevel+1 > 25) then outputChatBox("#ff4000*#FFFFFFCongratulations#ff4000!#FFFFFF You are now level #ff4000["..specialLevelNames[playerLevel-24].."]#FFFFFF!",thePlayer,255,255,255,true) outputChatBox("#ff4000*[ #FFFFFF"..getPlayerName(thePlayer).."#ff4000]#FFFFFF has levelled up! He/She is now level#FF0000 "..specialLevelNames[playerLevel-24].."#FFFFFF!",getRootElement(),255,255,255,true) else outputChatBox("#0000ff* #FFFFFFCongratulations#0000ff!#FFFFFF You are now level #ABCDEF"..playerLevel+1 .."#FFFFFF!",thePlayer,255,255,255,true) outputChatBox("#0000ff* #FFFFFF"..getPlayerName(thePlayer).."#FFFFFF has levelled up! He/She is now level#FF0000 "..playerLevel+1 .."#FFFFFF!",getRootElement(),255,255,255,true) end else outputChatBox("#0000ff* #FFFFFFYou need another #ABCDEF$"..levelPrices[playerLevel+1]-playerCash.."#FFFFFF to advance to the next level!",thePlayer,255,255,255,true) levelAchievements(thePlayer) return false end else outputChatBox("#0000ff* #FFFFFFYou have reached the maximum possible level! #0000ff[#FFFFFF Level 25 #FFFF00ELITE #0000ff]",thePlayer,255,255,255,true) return false end local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) if (playerLevel == 25) then outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff-------------------------------------",thePlayer,255,255,255,true) outputChatBox("#0000ff* #FFFFFFYou have reached level #FF000025#FFFFFF!",thePlayer,255,255,255,true) outputChatBox("#0000ff* #FFFFFFYou can now start again from level 10 in #FFFF00ELITE #FFFFFFmode!",thePlayer,255,255,255,true) outputChatBox("#0000ff-------------------------------------",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) elseif (playerLevel == 26) then outputChatBox("#0000ff* #FFFFFFYou now earn more money from winning and setting new top hunter times!",thePlayer,255,255,255,true) elseif (playerLevel == 41) then outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff---------------------------------------",thePlayer,255,255,255,true) outputChatBox("#0000ff* Congratulations on reaching level #0000ff ELITE#0000ff!",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) outputChatBox("#0000ff* You have reached the maximum level!",thePlayer,255,255,255,true) outputChatBox("#0000ff---------------------------------------",thePlayer,255,255,255,true) outputChatBox("#0000ff",thePlayer,255,255,255,true) end scoreboardRefresh(thePlayer) refreshStats(thePlayer) progressBarUpdate(thePlayer) levelAchievements(thePlayer) end function refreshStats(thePlayer) local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) local unlockedAchievements = tonumber(loadPlayerData(thePlayer,"unlockedAchievements")) local totalTimesJoined = tonumber(loadPlayerData(thePlayer,"totalTimesJoined")) local mapsWon = tonumber(loadPlayerData(thePlayer,"mapsWon")) local mapsPlayed = tonumber(loadPlayerData(thePlayer,"mapsPlayed")) local totalHunters = tonumber(loadPlayerData(thePlayer,"totalHunters")) local totalToptimes = tonumber(loadPlayerData(thePlayer,"totalToptimes")) local totalMoneyEarned = tonumber(loadPlayerData(thePlayer,"totalMoneyEarned")) local totalMoneySent = tonumber(loadPlayerData(thePlayer,"totalMoneySent")) local totalBets = tonumber(loadPlayerData(thePlayer,"totalBets")) local totalBetsEarned = tonumber(loadPlayerData(thePlayer,"totalBetsEarned")) local totalBetsWon = tonumber(loadPlayerData(thePlayer,"totalBetsWon")) local totalDeaths = tonumber(loadPlayerData(thePlayer,"totalDeaths")) local totalPlayingTimeMinutes = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeMinutes")) local totalPlayingTimeHours = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeHours")) local totalReactionTests = tonumber(loadPlayerData(thePlayer,"totalReactionTests")) local bestReactionTime = tonumber(loadPlayerData(thePlayer,"bestReactionTime")) levelImage = getRankingImage(playerLevel) levelDisplay = getEliteName(playerLevel) local winRatio = 0 if mapsPlayed == 0 and mapsWon == 0 then winRatio = 0 elseif mapsPlayed ~= 0 and mapsWon == 0 then winRatio = 0 elseif mapsPlayed ~= 0 and mapsWon ~= 0 then winRatio = math.round(((100/mapsPlayed)*mapsWon),2) elseif mapsWon > mapsPlayed then winRatio = 0 end callClientFunction(thePlayer,"refreshStats",levelDisplay,levelImage,playerCash,unlockedAchievements,totalTimesJoined,mapsWon,mapsPlayed,winRatio,totalHunters,totalToptimes,totalMoneyEarned,totalMoneySent,totalBets,totalBetsEarned,totalBetsWon,totalDeaths,totalPlayingTimeMinutes,totalPlayingTimeHours,totalReactionTests,bestReactionTime) end function checkForFirstTimeJoined(thePlayer) local joinedBefore = tonumber(loadPlayerData(thePlayer,"joinedBefore")) if joinedBefore == 0 then callClientFunction(callClientFunction,1000,1,thePlayer,"performSettingsUpdate") savePlayerData(thePlayer,"joinedBefore",1) outputChatBox("#ff4000*#FF0000Welcome to The Proffessionals, #ff4000[#ffffff"..getPlayerName(thePlayer.."#ff4000]#FFFFFF!",thePlayer,255,255,255,true)) end end function getDataOnStart(thePlayer) local pName = loadPlayerData(thePlayer,"pName") local pAge = loadPlayerData(thePlayer,"pAge") local pEmail = loadPlayerData(thePlayer,"pEmail") local pMsn = loadPlayerData(thePlayer,"pMsn") local pSkype = loadPlayerData(thePlayer,"pSkype") local pXfire = loadPlayerData(thePlayer,"pXfire") local pICQ = loadPlayerData(thePlayer,"pICQ") local pXBL = loadPlayerData(thePlayer,"pXBL") callClientFunction(thePlayer,"setDataOnStart",pName,pAge,pEmail,pMsn,pSkype,pXfire,pICQ,pXBL) end function getPersonalDetails(requestingPlayer,thePlayerName) local thePlayer = findPlayerByName(thePlayerName) local allowPersonalDetails = loadPlayerData(thePlayer,"allowPersonalDetails") if allowPersonalDetails == tostring(true) or tonumber(allowPersonalDetails) == 0 then local pName = loadPlayerData(thePlayer,"pName") local pAge = loadPlayerData(thePlayer,"pAge") local pEmail = loadPlayerData(thePlayer,"pEmail") local pMsn = loadPlayerData(thePlayer,"pMsn") local pSkype = loadPlayerData(thePlayer,"pSkype") local pXfire = loadPlayerData(thePlayer,"pXfire") local pICQ = loadPlayerData(thePlayer,"pICQ") local pXBL = loadPlayerData(thePlayer,"pXBL") callClientFunction(requestingPlayer,"displayPersonalDetails",pName,pAge,pEmail,pMsn,pSkype,pXfire,pICQ,pXBL) else outputChatBox("#0000ff* #FFFFFFThe other player has disabled viewing his personal details!",requestingPlayer,255,255,255,true) end end function getPlayerRaceStats(requestingPlayer,thePlayerName) local thePlayer = findPlayerByName(thePlayerName) local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) local unlockedAchievements = tonumber(loadPlayerData(thePlayer,"unlockedAchievements")) local totalTimesJoined = tonumber(loadPlayerData(thePlayer,"totalTimesJoined")) local mapsWon = tonumber(loadPlayerData(thePlayer,"mapsWon")) local mapsPlayed = tonumber(loadPlayerData(thePlayer,"mapsPlayed")) local totalHunters = tonumber(loadPlayerData(thePlayer,"totalHunters")) local totalToptimes = tonumber(loadPlayerData(thePlayer,"totalToptimes")) local totalMoneyEarned = tonumber(loadPlayerData(thePlayer,"totalMoneyEarned")) local totalMoneySent = tonumber(loadPlayerData(thePlayer,"totalMoneySent")) local totalBets = tonumber(loadPlayerData(thePlayer,"totalBets")) local totalBetsEarned = tonumber(loadPlayerData(thePlayer,"totalBetsEarned")) local totalBetsWon = tonumber(loadPlayerData(thePlayer,"totalBetsWon")) local totalDeaths = tonumber(loadPlayerData(thePlayer,"totalDeaths")) local totalPlayingTimeMinutes = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeMinutes")) local totalPlayingTimeHours = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeHours")) end function getPlayerStats(triggeringPlayer,thePlayer) local allowStats = loadPlayerData(thePlayer,"allowStats") if allowStats == tostring(true) or tonumber(allowStats) == 0 then local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) local unlockedAchievements = tonumber(loadPlayerData(thePlayer,"unlockedAchievements")) local totalTimesJoined = tonumber(loadPlayerData(thePlayer,"totalTimesJoined")) local mapsWon = tonumber(loadPlayerData(thePlayer,"mapsWon")) local mapsPlayed = tonumber(loadPlayerData(thePlayer,"mapsPlayed")) local totalHunters = tonumber(loadPlayerData(thePlayer,"totalHunters")) local totalToptimes = tonumber(loadPlayerData(thePlayer,"totalToptimes")) local totalMoneyEarned = tonumber(loadPlayerData(thePlayer,"totalMoneyEarned")) local totalMoneySent = tonumber(loadPlayerData(thePlayer,"totalMoneySent")) local totalBets = tonumber(loadPlayerData(thePlayer,"totalBets")) local totalBetsEarned = tonumber(loadPlayerData(thePlayer,"totalBetsEarned")) local totalBetsWon = tonumber(loadPlayerData(thePlayer,"totalBetsWon")) local totalDeaths = tonumber(loadPlayerData(thePlayer,"totalDeaths")) local totalPlayingTimeMinutes = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeMinutes")) local totalPlayingTimeHours = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeHours")) local totalReactionTests = tonumber(loadPlayerData(thePlayer,"totalReactionTests")) local bestReactionTime = tonumber(loadPlayerData(thePlayer,"bestReactionTime")) levelImage = getRankingImage(playerLevel) levelDisplay = getEliteName(playerLevel) local winRatio = 0 if mapsPlayed == 0 and mapsWon == 0 then winRatio = 0 elseif mapsPlayed ~= 0 and mapsWon == 0 then winRatio = 0 elseif mapsPlayed ~= 0 and mapsWon ~= 0 then winRatio = math.round(((100/mapsPlayed)*mapsWon),2) elseif mapsWon > mapsPlayed then winRatio = 0 end callClientFunction(triggeringPlayer,"displayPersonalStats",thePlayer,levelDisplay,levelImage,playerCash,unlockedAchievements,totalTimesJoined,mapsWon,mapsPlayed,winRatio,totalHunters,totalToptimes,totalMoneyEarned,totalMoneySent,totalBets,totalBetsEarned,totalBetsWon,totalDeaths,totalPlayingTimeMinutes,totalPlayingTimeHours,totalReactionTests,bestReactionTime) else outputChatBox("#0000ff* #FFFFFFThe other player has disabled viewing his stats!",triggeringPlayer,255,255,255,true) end end function buyMap(thePlayer,mapName) local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) addEvent("onScriptSetNextMap",true) addEventHandler("onScriptSetNextMap",getRootElement(), function (mapName) thePlayer = source local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) function getClientSettings(thePlayer) a = loadPlayerData(thePlayer,"allowPersonalDetails") b = loadPlayerData(thePlayer,"allowStats") c = loadPlayerData(thePlayer,"useCustomNametag") d = loadPlayerData(thePlayer,"useCustomSkin") e = loadPlayerData(thePlayer,"useCustomVehicleColor") f = loadPlayerData(thePlayer,"soundMessage") g = loadPlayerData(thePlayer,"soundRequest") h = loadPlayerData(thePlayer,"showOnDeath") i = loadPlayerData(thePlayer,"useHunterSkin") j = loadPlayerData(thePlayer,"chatAcceptMode") callClientFunction(thePlayer,"configureOptions",true,a,b,c,d,e,f,g,h,i,j) end function showUserpanelOnDeath() if (loadPlayerData(source,"showOnDeath") == "true") then callClientFunction(source,"displayUserpanel") end function saveNametagColor(thePlayer,r,g,b) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash-nametagPrice) savePlayerData(thePlayer,"nametagRed",r) savePlayerData(thePlayer,"nametagGreen",g) savePlayerData(thePlayer,"nametagBlue",b) setNametagColor(thePlayer) outputChatBox("#*#FFFFFFYou have purchased a new nametag color for #ABCDEF$"..nametagPrice.."#FFFFFF!",thePlayer,255,255,255,true) savePlayerData(thePlayer,"everPurchasedNametagColor",1) setElementData(thePlayer,"everPurchasedNametagColor",1) scoreboardRefresh(thePlayer) end function getNametagLevel(thePlayer) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) if playerLevel >= nametagLevel then if playerCash >= nametagPrice then callClientFunction(thePlayer,"showNametagWindow") else outputChatBox("#ff4000*#FFFFFFERROR! You don't have enough money!",thePlayer,255,255,255,true) end else outputChatBox("#ff4000*#FFFFFFERROR! You need to be level #ABCDEF"..nametagLevel.."#FFFFFF or higher to change your nametag color!",thePlayer,255,255,255,true) end end function setNametagColor(thePlayer) local ifSet = tonumber(getElementData(thePlayer,"everPurchasedNametagColor")) if ifSet == 1 then local useColor = loadPlayerData(thePlayer,"useCustomNametag") if useColor == "true" then local r = tonumber(loadPlayerData(thePlayer,"nametagRed")) local g = tonumber(loadPlayerData(thePlayer,"nametagGreen")) local b = tonumber(loadPlayerData(thePlayer,"nametagBlue")) callClientFunction(thePlayer,"setCustomNametagColor",true,r,g,b) end end end addEventHandler("onPlayerJoin",getRootElement(),setNametagColor) Link to comment
Cadu12 Posted February 15, 2013 Share Posted February 15, 2013 Are you using XML for save/load system? If so, thats bad idea, it will get DDoS/Crash. Link to comment
Scooby Posted February 15, 2013 Share Posted February 15, 2013 where are the loadplayerdata and saveplayerdata functions? i dont see them posted here. Link to comment
MR.S3D Posted February 15, 2013 Share Posted February 15, 2013 Xml function is free lag try make your script with sql or mysql Link to comment
Sex* Posted February 15, 2013 Author Share Posted February 15, 2013 And that scripter also told that setAccountData and getAccountData would be better. But how much? Is setAccountData and getaccountData without XML and the saving works after server restart? And yes im using XML right now. Link to comment
Anderl Posted February 15, 2013 Share Posted February 15, 2013 Are you using XML for save/load system? If so, thats bad idea, it will get DDoS/Crash. What are you talking about? I've never seen any problems with XML except the big file size when saving too much information. And what DDoS has to do with XML? Link to comment
Sex* Posted February 16, 2013 Author Share Posted February 16, 2013 And that scripter also told that setAccountData and getAccountData would be better. But how much? Is setAccountData and getaccountData without XML and the saving works after server restart? And yes im using XML right now. Please dont start an argue. So? what should be the best? Link to comment
JR10 Posted February 16, 2013 Share Posted February 16, 2013 XML is consuming, I remember it crashing a server with only 15 players playing. Since you're saving player data, just use account data. Link to comment
Anderl Posted February 16, 2013 Share Posted February 16, 2013 Oh well, I've never seen any problem with XML. Link to comment
Sex* Posted February 16, 2013 Author Share Posted February 16, 2013 XML is consuming, I remember it crashing a server with only 15 players playing.Since you're saving player data, just use account data. That dont use XML and is unlaggy? Link to comment
JR10 Posted February 16, 2013 Share Posted February 16, 2013 Account data uses SQLite, so it shouldn't lag. Link to comment
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