Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.96 KB | None | 0 0
  1. addEvent("onMapStarting", true)
  2.  
  3. IsRespawn = false
  4.  
  5. function MapStarting(mapInfo, mapOptions, gameOptions)
  6. IsRespawn = (tostring(mapOptions["respawn"]) == "timelimit")
  7. end
  8. addEventHandler("onMapStarting", getRootElement(), MapStarting)
  9.  
  10. function PlayerWasted( ammo, attacker, weapon, bodypart )
  11. local alivePlayers = getAlivePlayers()
  12. if not IsRespawn then
  13. if #alivePlayers == 1 then
  14. if not isGuestAccount( getPlayerAccount ( alivePlayers[1] ) ) then
  15. local PlayerName = getPlayerName(alivePlayers[1])
  16. local getPlayerAcc = getPlayerAccount ( alivePlayers[1] )
  17. if (getPlayerAcc) then
  18. local Losers = getAccountData(getPlayerAcc, "Losers")
  19. local Wins1 = getAccountData(getPlayerAcc, "Wins")
  20. local Wins2 = Wins1 + 1
  21. setAccountData ( getPlayerAcc, "Wins", Wins2 )
  22. setElementData(alivePlayers[1] ,"data.wins", Wins2)
  23. 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)
  24. -- Cash --
  25. local getPlayerCash = getPlayerAccount ( alivePlayers[1] )
  26. local Cash1 = getAccountData(getPlayerCash, "Cash")
  27. local Cash2 = 250 * getPlayerCount()
  28. setAccountData ( getPlayerCash, "Cash", Cash1 + Cash2 )
  29. setElementData ( alivePlayers[1], "data.cash", Cash1 + Cash2 )
  30. outputChatBox("* #FFFFFF" .. PlayerName .. "#0fc0fc got #FFFFFF" .. Cash2 .. "#0fc0fc$ for surviving!", getRootElement(), 255, 255, 255, true)
  31. -- Points --
  32. local getPlayerPoints = getPlayerAccount ( alivePlayers[1] )
  33. local Points1 = getAccountData(getPlayerCash, "Points")
  34. local Points2 = 4 * getPlayerCount()
  35. setAccountData ( getPlayerPoints, "Points", Points1 + Points2 )
  36. setElementData ( alivePlayers[1], "data.points", Points1 + Points2 )
  37. outputChatBox("* #FFFFFF" .. PlayerName .. "#0fc0fc got #FFFFFF" .. Points2 .. "#0fc0fc points! now has #FFFFFF" .. Points1 + Points2 .. "#0fc0fc!", getRootElement(), 255, 255, 255, true)
  38. -- Losers
  39. local Losers1 = getAccountData(getPlayerAcc, "Losers")
  40. local Losers2 = Losers1
  41. setAccountData (getPlayerAcc, "Losers", Losers2 )
  42. setElementData(source, "data.lost", Losers2)
  43. end
  44. else
  45. outputChatBox("* #FFFFFF" .. getPlayerName( alivePlayers[1] ) .. "#0fc0fc won as last player alive!", getRootElement(), 255, 255, 255, true)
  46. end
  47. end
  48. end
  49. local getPlayerAcc = getPlayerAccount ( source )
  50. if not isGuestAccount( getPlayerAccount ( source ) ) then
  51. local Losers1 = getAccountData(getPlayerAcc, "Losers")
  52. local Losers2 = Losers1 + 1
  53. setAccountData (getPlayerAcc, "Losers", Losers2 )
  54. setElementData(source, "data.lost", Losers2)
  55. end
  56. Ach1 ( source )
  57. end
  58. addEventHandler ( "onPlayerWasted", getRootElement(), PlayerWasted )
  59.  
  60. -- Achievements Main --
  61.  
  62. function Ach1 ( )
  63.  
  64. local PlayerName = getPlayerName ( source )
  65. local playeracc = getPlayerAccount ( source )
  66. if playeracc then
  67. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  68. local AchEarned2 = AchEarned + 1
  69. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  70. local AchPoints2 = AchPoints + 5
  71. local Ach1 = getAccountData ( playeracc, "Ach1" )
  72. local Ach1Completed = Ach1 + 1
  73. local AchWins = getAccountData ( playeracc, "Wins" )
  74. if tonumber( AchWins ) == 1 then
  75. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  76. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  77. setAccountData ( playeracc, "Ach1", Ach1Completed )
  78. setElementData ( source, "data.achearned", AchEarned2 )
  79. setElementData ( source, "data.achpoints", AchPoints2 )
  80. setElementData ( source, "data.ach1", Ach1Completed )
  81. outputChatBox ( PlayerName .. " unlocked the achievement 'Newbie Derbier' for winning 10 maps (5 XG Points) ", root, 0, 252, 255, false )
  82. end
  83. end
  84. end
  85.  
  86. function Ach2 ( )
  87.  
  88. local PlayerName = getPlayerName ( source )
  89. local playeracc = getPlayerAccount ( source )
  90. if playeracc then
  91. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  92. local AchEarned2 = AchEarned + 1
  93. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  94. local AchPoints2 = AchPoints + 10
  95. local Ach2 = getAccountData ( playeracc, "Ach2" )
  96. local Ach2Completed = Ach2 + 1
  97. local AchWins2 = getAccountData ( playeracc, "Wins" )
  98. if tonumber( AchWins ) == 50 then
  99. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  100. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  101. setAccountData ( playeracc, "Ach2", Ach2Completed )
  102. setElementData ( source, "data.ach2", Ach2Completed )
  103. outputChatBox ( PlayerName .. " unlocked the achievement ' Rookie derbier ' for winning 50 maps (10 XG Points) ", root, 0, 252, 255, false )
  104. end
  105. end
  106. end
  107.  
  108. function Ach3 ( )
  109.  
  110. local PlayerName = getPlayerName ( source )
  111. local playeracc = getPlayerAccount ( source )
  112. if playeracc then
  113. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  114. local AchEarned2 = AchEarned + 1 setElementData ( source, "data.achearned", AchEarned2 )
  115. setElementData ( source, "data.achpoints", AchPoints2 )
  116. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  117. local AchPoints2 = AchPoints + 15
  118. local Ach3 = getAccountData ( playeracc, "Ach3" )
  119. local Ach3Completed = Ach3 + 1
  120. local AchWins = getAccountData ( playeracc, "Wins" )
  121. if tonumber( AchWins ) == 100 then
  122. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  123. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  124. setAccountData ( playeracc, "Ach3", Ach3Completed )
  125. setElementData ( source, "data.achearned", AchEarned2 )
  126. setElementData ( source, "data.achpoints", AchPoints2 )
  127. setElementData ( source, "data.ach3", Ach3Completed )
  128. outputChatBox ( PlayerName .. " unlocked the achievement ' Proffesional derbier ' for winning 100 maps (15 XG Points) ", root, 0, 252, 255, false )
  129. end
  130. end
  131. end
  132.  
  133. function Ach4 ( )
  134.  
  135. local PlayerName = getPlayerName ( source )
  136. local playeracc = getPlayerAccount ( source )
  137. if playeracc then
  138. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  139. local AchEarned2 = AchEarned + 1
  140. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  141. local AchPoints2 = AchPoints + 25
  142. local Ach4 = getAccountData ( playeracc, "Ach4" )
  143. local Ach4Completed = Ach4 + 1
  144. local AchWins = getAccountData ( playeracc, "Wins" )
  145. if tonumber( AchWins ) == 500 then
  146. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  147. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  148. setAccountData ( playeracc, "Ach4", Ach4Completed )
  149. setElementData ( source, "data.achearned", AchEarned2 )
  150. setElementData ( source, "data.achpoints", AchPoints2 )
  151. setElementData ( source, "data.ach4", Ach4Completed )
  152. outputChatBox ( PlayerName .. " unlocked the achievement ' Veteran derbier ' for winning 500 maps (25 XG Points) ", root, 0, 252, 255, false )
  153. end
  154. end
  155. end
  156.  
  157. function Ach5 ( )
  158.  
  159. local PlayerName = getPlayerName ( source )
  160. local playeracc = getPlayerAccount ( source )
  161. if playeracc then
  162. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  163. local AchEarned2 = AchEarned + 1
  164. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  165. local AchPoints2 = AchPoints + 40
  166. local Ach5 = getAccountData ( playeracc, "Ach5" )
  167. local Ach5Completed = Ach5 + 1
  168. local AchWins = getAccountData ( playeracc, "Wins" )
  169. if tonumber( AchWins ) == 1000 then
  170. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  171. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  172. setAccountData ( playeracc, "Ach5", Ach5Completed )
  173. setElementData ( source, "data.achearned", AchEarned2 )
  174. setElementData ( source, "data.achpoints", AchPoints2 )
  175. setElementData ( source, "data.ach5", Ach5Completed )
  176. outputChatBox ( PlayerName .. " unlocked the achievement ' XG God derbier ' for winning 1000 maps (40 XG Points) ", root, 0, 252, 255, false )
  177. end
  178. end
  179. end
  180.  
  181. function Logged()
  182. local getPlayerAcc = getPlayerAccount ( source )
  183. local FalseAddSQL = getAccountData(getPlayerAcc, "AddSQL")
  184. local AddsSQL = getAccountData(getPlayerAcc, "AddSQL")
  185. if AddsSQL == "1.1" then
  186. outputChatBox("* #FFFFFF" .. getPlayerName( source ) .. "#0fc0fc has logged in and and he's ready to play!", getRootElement(), 255, 255, 255, true)
  187. -- User Panel
  188. local PlayerName = getPlayerName(source)
  189. local getPlayerAcc = getPlayerAccount ( source )
  190. local Cash = getAccountData(getPlayerAcc, "Cash") -- Cash
  191. local Ranking = getAccountData(getPlayerAcc, "Rank") -- Ranking
  192. local Points = getAccountData(getPlayerAcc, "Points") -- Points
  193. local Exp = getAccountData(getPlayerAcc, "Exp") -- Exp
  194. local Wins = getAccountData(getPlayerAcc, "Wins") -- Wins
  195. local Loser = getAccountData(getPlayerAcc, "Losers") -- Losers
  196. local AchEarned = getAccountData(getPlayerAcc, "AchEarned") -- Achievements earned
  197. local AchPoints = getAccountData(getPlayerAcc, "AchPoints") -- Achievement points
  198. local Ach1 = getAccountData(getPlayerAcc, "Ach1") -- Ach #1
  199. local Ach2 = getAccountData(getPlayerAcc, "Ach2") -- Ach #2
  200. local Ach3 = getAccountData(getPlayerAcc, "Ach3") -- Ach #3
  201. local Ach4 = getAccountData(getPlayerAcc, "Ach4") -- Ach #4
  202. local Ach5 = getAccountData(getPlayerAcc, "Ach5") -- Ach #5
  203. setElementData(source, "data.rank", Ranking)
  204. setElementData(source, "data.wins", Wins)
  205. setElementData(source, "data.lost", Loser)
  206. setElementData(source, "data.points", Points)
  207. setElementData(source, "data.cash", Cash)
  208. setElementData(source, "data.exp", Exp)
  209. setElementData(source, "data.achearned", AchEarned)
  210. setElementData(source, "data.achpoints", AchPoints)
  211. setElementData(source, "data.ach1", Ach1)
  212. setElementData(source, "data.ach2", Ach2)
  213. setElementData(source, "data.ach3", Ach3)
  214. setElementData(source, "data.ach4", Ach4)
  215. setElementData(source, "data.ach5", Ach5)
  216. -- Anti-Guest
  217. setElementData(source, "data.guest", "true")
  218. else
  219. local Rank = "Beginner"
  220. local Wins = 0
  221. local Losers = 0
  222. local Points = 0
  223. local Cash = 0
  224. local Exp = 1
  225. local AchEarned = 0
  226. local AchPoints = 0
  227. local Ach1 = 0
  228. local Ach2 = 0
  229. local Ach3 = 0
  230. local Ach4 = 0
  231. local Ach5 = 0
  232. setAccountData(getPlayerAcc, "Rank", Rank)
  233. setAccountData(getPlayerAcc, "Wins", Wins)
  234. setAccountData(getPlayerAcc, "Losers", Losers)
  235. setAccountData(getPlayerAcc, "Points", Points)
  236. setAccountData(getPlayerAcc, "Cash", Cash)
  237. setAccountData(getPlayerAcc, "Exp", Exp)
  238. setAccountData(getPlayerAcc, "AchEarned", AchEarned) -- Achievements earned
  239. setAccountData(getPlayerAcc, "AchPoints", AchPoints) -- Achievement points
  240. setAccountData(getPlayerAcc, "Ach1", Ach1) -- Ach #1
  241. setAccountData(getPlayerAcc, "Ach2", Ach2) -- Ach #2
  242. setAccountData(getPlayerAcc, "Ach3", Ach3) -- Ach #3
  243. setAccountData(getPlayerAcc, "Ach4", Ach4) -- Ach #4
  244. setAccountData(getPlayerAcc, "Ach5", Ach5) -- Ach #5
  245. -- NO ANYMORE SET STATS ANYMORE
  246. setAccountData(getPlayerAcc, "AddSQL", "1.1")
  247. outputChatBox("* #FFFFFF" .. getPlayerName( source ) .. "#0fc0fc has logged in and he's ready to play for the first time!", getRootElement(), 255, 255, 255, true)
  248. -- Anti-Guest
  249. setElementData(source, "data.guest", "true")
  250. -- Updated
  251. setElementData(source, "data.rank", Rank)
  252. setElementData(source, "data.wins", Wins)
  253. setElementData(source, "data.lost", Losers)
  254. setElementData(source, "data.points", Points)
  255. setElementData(source, "data.cash", Cash)
  256. setElementData(source, "data.exp", Exp)
  257. setElementData(source, "data.achearned", AchEarned)
  258. setElementData(source, "data.achpoints", AchPoints)
  259. setElementData(source, "data.ach1", Ach1)
  260. setElementData(source, "data.ach2", Ach2)
  261. setElementData(source, "data.ach3", Ach3)
  262. setElementData(source, "data.ach4", Ach4)
  263. setElementData(source, "data.ach5", Ach5)
  264. end
  265. end
  266. addEventHandler("onPlayerLogin", getRootElement(), Logged)
  267.  
  268. function Logouted()
  269. setElementData(source, "data.guest", "false")
  270. end
  271. addEventHandler("onPlayerLogout",getRootElement(),Logouted)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement