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)