Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEvent("onMapStarting", true)
- IsRespawn = false
- function MapStarting(mapInfo, mapOptions, gameOptions)
- IsRespawn = (tostring(mapOptions["respawn"]) == "timelimit")
- end
- addEventHandler("onMapStarting", getRootElement(), MapStarting)
- function PlayerWasted( ammo, attacker, weapon, bodypart )
- local alivePlayers = getAlivePlayers()
- if not IsRespawn then
- if #alivePlayers == 1 then
- if not isGuestAccount( getPlayerAccount ( alivePlayers[1] ) ) then
- local PlayerName = getPlayerName(alivePlayers[1])
- local getPlayerAcc = getPlayerAccount ( alivePlayers[1] )
- if (getPlayerAcc) then
- local Losers = getAccountData(getPlayerAcc, "Losers")
- local Wins1 = getAccountData(getPlayerAcc, "Wins")
- local Wins2 = Wins1 + 1
- setAccountData ( getPlayerAcc, "Wins", Wins2 )
- setElementData(alivePlayers[1] ,"data.wins", Wins2)
- outputChatBox("* #FFFFFF" .. PlayerName .. "#0fc0fc won as last player alive! Totals DM/DD won: #FFFFFF" .. Wins2 .. " #0fc0fcof #FFFFFF" .. Losers .. "#0fc0fc losers.", getRootElement(), 255, 255, 255, true)
- -- Cash --
- local getPlayerCash = getPlayerAccount ( alivePlayers[1] )
- local Cash1 = getAccountData(getPlayerCash, "Cash")
- local Cash2 = 250 * getPlayerCount()
- setAccountData ( getPlayerCash, "Cash", Cash1 + Cash2 )
- setElementData ( alivePlayers[1], "data.cash", Cash1 + Cash2 )
- outputChatBox("* #FFFFFF" .. PlayerName .. "#0fc0fc got #FFFFFF" .. Cash2 .. "#0fc0fc$ for surviving!", getRootElement(), 255, 255, 255, true)
- -- Points --
- local getPlayerPoints = getPlayerAccount ( alivePlayers[1] )
- local Points1 = getAccountData(getPlayerCash, "Points")
- local Points2 = 4 * getPlayerCount()
- setAccountData ( getPlayerPoints, "Points", Points1 + Points2 )
- setElementData ( alivePlayers[1], "data.points", Points1 + Points2 )
- outputChatBox("* #FFFFFF" .. PlayerName .. "#0fc0fc got #FFFFFF" .. Points2 .. "#0fc0fc points! now has #FFFFFF" .. Points1 + Points2 .. "#0fc0fc!", getRootElement(), 255, 255, 255, true)
- -- Losers
- local Losers1 = getAccountData(getPlayerAcc, "Losers")
- local Losers2 = Losers1
- setAccountData (getPlayerAcc, "Losers", Losers2 )
- setElementData(source, "data.lost", Losers2)
- end
- else
- outputChatBox("* #FFFFFF" .. getPlayerName( alivePlayers[1] ) .. "#0fc0fc won as last player alive!", getRootElement(), 255, 255, 255, true)
- end
- end
- end
- local getPlayerAcc = getPlayerAccount ( source )
- if not isGuestAccount( getPlayerAccount ( source ) ) then
- local Losers1 = getAccountData(getPlayerAcc, "Losers")
- local Losers2 = Losers1 + 1
- setAccountData (getPlayerAcc, "Losers", Losers2 )
- setElementData(source, "data.lost", Losers2)
- end
- Ach1 ( source )
- end
- addEventHandler ( "onPlayerWasted", getRootElement(), PlayerWasted )
- -- Achievements Main --
- function Ach1 ( )
- local PlayerName = getPlayerName ( source )
- local playeracc = getPlayerAccount ( source )
- if playeracc then
- local AchEarned = getAccountData ( playeracc, "AchEarned" )
- local AchEarned2 = AchEarned + 1
- local AchPoints = getAccountData ( playeracc, "AchPoints" )
- local AchPoints2 = AchPoints + 5
- local Ach1 = getAccountData ( playeracc, "Ach1" )
- local Ach1Completed = Ach1 + 1
- local AchWins = getAccountData ( playeracc, "Wins" )
- if tonumber( AchWins ) == 1 then
- setAccountData ( playeracc, "AchEarned", AchEarned2 )
- setAccountData ( playeracc, "AchPoints", AchPoints2 )
- setAccountData ( playeracc, "Ach1", Ach1Completed )
- setElementData ( source, "data.achearned", AchEarned2 )
- setElementData ( source, "data.achpoints", AchPoints2 )
- setElementData ( source, "data.ach1", Ach1Completed )
- outputChatBox ( PlayerName .. " unlocked the achievement 'Newbie Derbier' for winning 10 maps (5 XG Points) ", root, 0, 252, 255, false )
- end
- end
- end
- function Ach2 ( )
- local PlayerName = getPlayerName ( source )
- local playeracc = getPlayerAccount ( source )
- if playeracc then
- local AchEarned = getAccountData ( playeracc, "AchEarned" )
- local AchEarned2 = AchEarned + 1
- local AchPoints = getAccountData ( playeracc, "AchPoints" )
- local AchPoints2 = AchPoints + 10
- local Ach2 = getAccountData ( playeracc, "Ach2" )
- local Ach2Completed = Ach2 + 1
- local AchWins2 = getAccountData ( playeracc, "Wins" )
- if tonumber( AchWins ) == 50 then
- setAccountData ( playeracc, "AchEarned", AchEarned2 )
- setAccountData ( playeracc, "AchPoints", AchPoints2 )
- setAccountData ( playeracc, "Ach2", Ach2Completed )
- setElementData ( source, "data.ach2", Ach2Completed )
- outputChatBox ( PlayerName .. " unlocked the achievement ' Rookie derbier ' for winning 50 maps (10 XG Points) ", root, 0, 252, 255, false )
- end
- end
- end
- function Ach3 ( )
- local PlayerName = getPlayerName ( source )
- local playeracc = getPlayerAccount ( source )
- if playeracc then
- local AchEarned = getAccountData ( playeracc, "AchEarned" )
- local AchEarned2 = AchEarned + 1 setElementData ( source, "data.achearned", AchEarned2 )
- setElementData ( source, "data.achpoints", AchPoints2 )
- local AchPoints = getAccountData ( playeracc, "AchPoints" )
- local AchPoints2 = AchPoints + 15
- local Ach3 = getAccountData ( playeracc, "Ach3" )
- local Ach3Completed = Ach3 + 1
- local AchWins = getAccountData ( playeracc, "Wins" )
- if tonumber( AchWins ) == 100 then
- setAccountData ( playeracc, "AchEarned", AchEarned2 )
- setAccountData ( playeracc, "AchPoints", AchPoints2 )
- setAccountData ( playeracc, "Ach3", Ach3Completed )
- setElementData ( source, "data.achearned", AchEarned2 )
- setElementData ( source, "data.achpoints", AchPoints2 )
- setElementData ( source, "data.ach3", Ach3Completed )
- outputChatBox ( PlayerName .. " unlocked the achievement ' Proffesional derbier ' for winning 100 maps (15 XG Points) ", root, 0, 252, 255, false )
- end
- end
- end
- function Ach4 ( )
- local PlayerName = getPlayerName ( source )
- local playeracc = getPlayerAccount ( source )
- if playeracc then
- local AchEarned = getAccountData ( playeracc, "AchEarned" )
- local AchEarned2 = AchEarned + 1
- local AchPoints = getAccountData ( playeracc, "AchPoints" )
- local AchPoints2 = AchPoints + 25
- local Ach4 = getAccountData ( playeracc, "Ach4" )
- local Ach4Completed = Ach4 + 1
- local AchWins = getAccountData ( playeracc, "Wins" )
- if tonumber( AchWins ) == 500 then
- setAccountData ( playeracc, "AchEarned", AchEarned2 )
- setAccountData ( playeracc, "AchPoints", AchPoints2 )
- setAccountData ( playeracc, "Ach4", Ach4Completed )
- setElementData ( source, "data.achearned", AchEarned2 )
- setElementData ( source, "data.achpoints", AchPoints2 )
- setElementData ( source, "data.ach4", Ach4Completed )
- outputChatBox ( PlayerName .. " unlocked the achievement ' Veteran derbier ' for winning 500 maps (25 XG Points) ", root, 0, 252, 255, false )
- end
- end
- end
- function Ach5 ( )
- local PlayerName = getPlayerName ( source )
- local playeracc = getPlayerAccount ( source )
- if playeracc then
- local AchEarned = getAccountData ( playeracc, "AchEarned" )
- local AchEarned2 = AchEarned + 1
- local AchPoints = getAccountData ( playeracc, "AchPoints" )
- local AchPoints2 = AchPoints + 40
- local Ach5 = getAccountData ( playeracc, "Ach5" )
- local Ach5Completed = Ach5 + 1
- local AchWins = getAccountData ( playeracc, "Wins" )
- if tonumber( AchWins ) == 1000 then
- setAccountData ( playeracc, "AchEarned", AchEarned2 )
- setAccountData ( playeracc, "AchPoints", AchPoints2 )
- setAccountData ( playeracc, "Ach5", Ach5Completed )
- setElementData ( source, "data.achearned", AchEarned2 )
- setElementData ( source, "data.achpoints", AchPoints2 )
- setElementData ( source, "data.ach5", Ach5Completed )
- outputChatBox ( PlayerName .. " unlocked the achievement ' XG God derbier ' for winning 1000 maps (40 XG Points) ", root, 0, 252, 255, false )
- end
- end
- end
- function Logged()
- local getPlayerAcc = getPlayerAccount ( source )
- local FalseAddSQL = getAccountData(getPlayerAcc, "AddSQL")
- local AddsSQL = getAccountData(getPlayerAcc, "AddSQL")
- if AddsSQL == "1.1" then
- outputChatBox("* #FFFFFF" .. getPlayerName( source ) .. "#0fc0fc has logged in and and he's ready to play!", getRootElement(), 255, 255, 255, true)
- -- User Panel
- local PlayerName = getPlayerName(source)
- local getPlayerAcc = getPlayerAccount ( source )
- local Cash = getAccountData(getPlayerAcc, "Cash") -- Cash
- local Ranking = getAccountData(getPlayerAcc, "Rank") -- Ranking
- local Points = getAccountData(getPlayerAcc, "Points") -- Points
- local Exp = getAccountData(getPlayerAcc, "Exp") -- Exp
- local Wins = getAccountData(getPlayerAcc, "Wins") -- Wins
- local Loser = getAccountData(getPlayerAcc, "Losers") -- Losers
- local AchEarned = getAccountData(getPlayerAcc, "AchEarned") -- Achievements earned
- local AchPoints = getAccountData(getPlayerAcc, "AchPoints") -- Achievement points
- local Ach1 = getAccountData(getPlayerAcc, "Ach1") -- Ach #1
- local Ach2 = getAccountData(getPlayerAcc, "Ach2") -- Ach #2
- local Ach3 = getAccountData(getPlayerAcc, "Ach3") -- Ach #3
- local Ach4 = getAccountData(getPlayerAcc, "Ach4") -- Ach #4
- local Ach5 = getAccountData(getPlayerAcc, "Ach5") -- Ach #5
- setElementData(source, "data.rank", Ranking)
- setElementData(source, "data.wins", Wins)
- setElementData(source, "data.lost", Loser)
- setElementData(source, "data.points", Points)
- setElementData(source, "data.cash", Cash)
- setElementData(source, "data.exp", Exp)
- setElementData(source, "data.achearned", AchEarned)
- setElementData(source, "data.achpoints", AchPoints)
- setElementData(source, "data.ach1", Ach1)
- setElementData(source, "data.ach2", Ach2)
- setElementData(source, "data.ach3", Ach3)
- setElementData(source, "data.ach4", Ach4)
- setElementData(source, "data.ach5", Ach5)
- -- Anti-Guest
- setElementData(source, "data.guest", "true")
- else
- local Rank = "Beginner"
- local Wins = 0
- local Losers = 0
- local Points = 0
- local Cash = 0
- local Exp = 1
- local AchEarned = 0
- local AchPoints = 0
- local Ach1 = 0
- local Ach2 = 0
- local Ach3 = 0
- local Ach4 = 0
- local Ach5 = 0
- setAccountData(getPlayerAcc, "Rank", Rank)
- setAccountData(getPlayerAcc, "Wins", Wins)
- setAccountData(getPlayerAcc, "Losers", Losers)
- setAccountData(getPlayerAcc, "Points", Points)
- setAccountData(getPlayerAcc, "Cash", Cash)
- setAccountData(getPlayerAcc, "Exp", Exp)
- setAccountData(getPlayerAcc, "AchEarned", AchEarned) -- Achievements earned
- setAccountData(getPlayerAcc, "AchPoints", AchPoints) -- Achievement points
- setAccountData(getPlayerAcc, "Ach1", Ach1) -- Ach #1
- setAccountData(getPlayerAcc, "Ach2", Ach2) -- Ach #2
- setAccountData(getPlayerAcc, "Ach3", Ach3) -- Ach #3
- setAccountData(getPlayerAcc, "Ach4", Ach4) -- Ach #4
- setAccountData(getPlayerAcc, "Ach5", Ach5) -- Ach #5
- -- NO ANYMORE SET STATS ANYMORE
- setAccountData(getPlayerAcc, "AddSQL", "1.1")
- outputChatBox("* #FFFFFF" .. getPlayerName( source ) .. "#0fc0fc has logged in and he's ready to play for the first time!", getRootElement(), 255, 255, 255, true)
- -- Anti-Guest
- setElementData(source, "data.guest", "true")
- -- Updated
- setElementData(source, "data.rank", Rank)
- setElementData(source, "data.wins", Wins)
- setElementData(source, "data.lost", Losers)
- setElementData(source, "data.points", Points)
- setElementData(source, "data.cash", Cash)
- setElementData(source, "data.exp", Exp)
- setElementData(source, "data.achearned", AchEarned)
- setElementData(source, "data.achpoints", AchPoints)
- setElementData(source, "data.ach1", Ach1)
- setElementData(source, "data.ach2", Ach2)
- setElementData(source, "data.ach3", Ach3)
- setElementData(source, "data.ach4", Ach4)
- setElementData(source, "data.ach5", Ach5)
- end
- end
- addEventHandler("onPlayerLogin", getRootElement(), Logged)
- function Logouted()
- setElementData(source, "data.guest", "false")
- end
- addEventHandler("onPlayerLogout",getRootElement(),Logouted)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement