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 12.85 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. -- Achievements --
  44. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  45. local AchEarned2 = AchEarned + 1
  46. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  47. local AchPoints2 = AchPoints + 5
  48. local Ach1 = getAccountData ( playeracc, "Ach1" )
  49. local Ach1Completed = Ach1 + 1
  50. if tonumber(Wins1) == 1 then
  51. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  52. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  53. setAccountData ( playeracc, "Ach1", Ach1Completed )
  54. setElementData ( source, "data.achearned", AchEarned2 )
  55. setElementData ( source, "data.achpoints", AchPoints2 )
  56. setElementData ( source, "data.ach1", Ach1Completed )
  57. outputChatBox ( PlayerName .. " unlocked the achievement 'Newbie Derbier' for winning 10 maps (5 XG Points) ", root, 0, 252, 255, false )
  58. end
  59. end
  60. else
  61. outputChatBox("* #FFFFFF" .. getPlayerName( alivePlayers[1] ) .. "#0fc0fc won as last player alive!", getRootElement(), 255, 255, 255, true)
  62. end
  63. Ach1 ( alivePlayers[1] )
  64. end
  65. end
  66. local getPlayerAcc = getPlayerAccount ( source )
  67. if not isGuestAccount( getPlayerAccount ( source ) ) then
  68. local Losers1 = getAccountData(getPlayerAcc, "Losers")
  69. local Losers2 = Losers1 + 1
  70. setAccountData (getPlayerAcc, "Losers", Losers2 )
  71. setElementData(source, "data.lost", Losers2)
  72. end
  73. end
  74. addEventHandler ( "onPlayerWasted", getRootElement(), PlayerWasted )
  75.  
  76. -- Achievements Main --
  77.  
  78. --[[function Ach1 ( )
  79.  
  80. local PlayerName = getPlayerName ( source )
  81. local playeracc = getPlayerAccount ( source )
  82. if playeracc then
  83. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  84. local AchEarned2 = AchEarned + 1
  85. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  86. local AchPoints2 = AchPoints + 5
  87. local Ach1 = getAccountData ( playeracc, "Ach1" )
  88. local Ach1Completed = Ach1 + 1
  89. local AchWins = getAccountData ( playeracc, "Wins" )
  90. if tonumber( AchWins ) == 1 then
  91. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  92. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  93. setAccountData ( playeracc, "Ach1", Ach1Completed )
  94. setElementData ( source, "data.achearned", AchEarned2 )
  95. setElementData ( source, "data.achpoints", AchPoints2 )
  96. setElementData ( source, "data.ach1", Ach1Completed )
  97. outputChatBox ( PlayerName .. " unlocked the achievement 'Newbie Derbier' for winning 10 maps (5 XG Points) ", root, 0, 252, 255, false )
  98. end
  99. end
  100. end
  101.  
  102. function Ach2 ( )
  103.  
  104. local PlayerName = getPlayerName ( source )
  105. local playeracc = getPlayerAccount ( source )
  106. if playeracc then
  107. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  108. local AchEarned2 = AchEarned + 1
  109. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  110. local AchPoints2 = AchPoints + 10
  111. local Ach2 = getAccountData ( playeracc, "Ach2" )
  112. local Ach2Completed = Ach2 + 1
  113. local AchWins2 = getAccountData ( playeracc, "Wins" )
  114. if tonumber( AchWins ) == 50 then
  115. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  116. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  117. setAccountData ( playeracc, "Ach2", Ach2Completed )
  118. setElementData ( source, "data.ach2", Ach2Completed )
  119. outputChatBox ( PlayerName .. " unlocked the achievement ' Rookie derbier ' for winning 50 maps (10 XG Points) ", root, 0, 252, 255, false )
  120. end
  121. end
  122. end
  123.  
  124. function Ach3 ( )
  125.  
  126. local PlayerName = getPlayerName ( source )
  127. local playeracc = getPlayerAccount ( source )
  128. if playeracc then
  129. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  130. local AchEarned2 = AchEarned + 1 setElementData ( source, "data.achearned", AchEarned2 )
  131. setElementData ( source, "data.achpoints", AchPoints2 )
  132. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  133. local AchPoints2 = AchPoints + 15
  134. local Ach3 = getAccountData ( playeracc, "Ach3" )
  135. local Ach3Completed = Ach3 + 1
  136. local AchWins = getAccountData ( playeracc, "Wins" )
  137. if tonumber( AchWins ) == 100 then
  138. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  139. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  140. setAccountData ( playeracc, "Ach3", Ach3Completed )
  141. setElementData ( source, "data.achearned", AchEarned2 )
  142. setElementData ( source, "data.achpoints", AchPoints2 )
  143. setElementData ( source, "data.ach3", Ach3Completed )
  144. outputChatBox ( PlayerName .. " unlocked the achievement ' Proffesional derbier ' for winning 100 maps (15 XG Points) ", root, 0, 252, 255, false )
  145. end
  146. end
  147. end
  148.  
  149. function Ach4 ( )
  150.  
  151. local PlayerName = getPlayerName ( source )
  152. local playeracc = getPlayerAccount ( source )
  153. if playeracc then
  154. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  155. local AchEarned2 = AchEarned + 1
  156. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  157. local AchPoints2 = AchPoints + 25
  158. local Ach4 = getAccountData ( playeracc, "Ach4" )
  159. local Ach4Completed = Ach4 + 1
  160. local AchWins = getAccountData ( playeracc, "Wins" )
  161. if tonumber( AchWins ) == 500 then
  162. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  163. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  164. setAccountData ( playeracc, "Ach4", Ach4Completed )
  165. setElementData ( source, "data.achearned", AchEarned2 )
  166. setElementData ( source, "data.achpoints", AchPoints2 )
  167. setElementData ( source, "data.ach4", Ach4Completed )
  168. outputChatBox ( PlayerName .. " unlocked the achievement ' Veteran derbier ' for winning 500 maps (25 XG Points) ", root, 0, 252, 255, false )
  169. end
  170. end
  171. end
  172.  
  173. function Ach5 ( )
  174.  
  175. local PlayerName = getPlayerName ( source )
  176. local playeracc = getPlayerAccount ( source )
  177. if playeracc then
  178. local AchEarned = getAccountData ( playeracc, "AchEarned" )
  179. local AchEarned2 = AchEarned + 1
  180. local AchPoints = getAccountData ( playeracc, "AchPoints" )
  181. local AchPoints2 = AchPoints + 40
  182. local Ach5 = getAccountData ( playeracc, "Ach5" )
  183. local Ach5Completed = Ach5 + 1
  184. local AchWins = getAccountData ( playeracc, "Wins" )
  185. if tonumber( AchWins ) == 1000 then
  186. setAccountData ( playeracc, "AchEarned", AchEarned2 )
  187. setAccountData ( playeracc, "AchPoints", AchPoints2 )
  188. setAccountData ( playeracc, "Ach5", Ach5Completed )
  189. setElementData ( source, "data.achearned", AchEarned2 )
  190. setElementData ( source, "data.achpoints", AchPoints2 )
  191. setElementData ( source, "data.ach5", Ach5Completed )
  192. outputChatBox ( PlayerName .. " unlocked the achievement ' XG God derbier ' for winning 1000 maps (40 XG Points) ", root, 0, 252, 255, false )
  193. end
  194. end
  195. end
  196. --]]
  197.  
  198. function Logged()
  199. local getPlayerAcc = getPlayerAccount ( source )
  200. local FalseAddSQL = getAccountData(getPlayerAcc, "AddSQL")
  201. local AddsSQL = getAccountData(getPlayerAcc, "AddSQL")
  202. if AddsSQL == "1.1" then
  203. outputChatBox("* #FFFFFF" .. getPlayerName( source ) .. "#0fc0fc has logged in and and he's ready to play!", getRootElement(), 255, 255, 255, true)
  204. -- User Panel
  205. local PlayerName = getPlayerName(source)
  206. local getPlayerAcc = getPlayerAccount ( source )
  207. local Cash = getAccountData(getPlayerAcc, "Cash") -- Cash
  208. local Ranking = getAccountData(getPlayerAcc, "Rank") -- Ranking
  209. local Points = getAccountData(getPlayerAcc, "Points") -- Points
  210. local Exp = getAccountData(getPlayerAcc, "Exp") -- Exp
  211. local Wins = getAccountData(getPlayerAcc, "Wins") -- Wins
  212. local Loser = getAccountData(getPlayerAcc, "Losers") -- Losers
  213. local AchEarned = getAccountData(getPlayerAcc, "AchEarned") -- Achievements earned
  214. local AchPoints = getAccountData(getPlayerAcc, "AchPoints") -- Achievement points
  215. local Ach1 = getAccountData(getPlayerAcc, "Ach1") -- Ach #1
  216. local Ach2 = getAccountData(getPlayerAcc, "Ach2") -- Ach #2
  217. local Ach3 = getAccountData(getPlayerAcc, "Ach3") -- Ach #3
  218. local Ach4 = getAccountData(getPlayerAcc, "Ach4") -- Ach #4
  219. local Ach5 = getAccountData(getPlayerAcc, "Ach5") -- Ach #5
  220. setElementData(source, "data.rank", Ranking)
  221. setElementData(source, "data.wins", Wins)
  222. setElementData(source, "data.lost", Loser)
  223. setElementData(source, "data.points", Points)
  224. setElementData(source, "data.cash", Cash)
  225. setElementData(source, "data.exp", Exp)
  226. setElementData(source, "data.achearned", AchEarned)
  227. setElementData(source, "data.achpoints", AchPoints)
  228. setElementData(source, "data.ach1", Ach1)
  229. setElementData(source, "data.ach2", Ach2)
  230. setElementData(source, "data.ach3", Ach3)
  231. setElementData(source, "data.ach4", Ach4)
  232. setElementData(source, "data.ach5", Ach5)
  233. -- Anti-Guest
  234. setElementData(source, "data.guest", "true")
  235. else
  236. local Rank = "Beginner"
  237. local Wins = 0
  238. local Losers = 0
  239. local Points = 0
  240. local Cash = 0
  241. local Exp = 1
  242. local AchEarned = 0
  243. local AchPoints = 0
  244. local Ach1 = 0
  245. local Ach2 = 0
  246. local Ach3 = 0
  247. local Ach4 = 0
  248. local Ach5 = 0
  249. setAccountData(getPlayerAcc, "Rank", Rank)
  250. setAccountData(getPlayerAcc, "Wins", Wins)
  251. setAccountData(getPlayerAcc, "Losers", Losers)
  252. setAccountData(getPlayerAcc, "Points", Points)
  253. setAccountData(getPlayerAcc, "Cash", Cash)
  254. setAccountData(getPlayerAcc, "Exp", Exp)
  255. setAccountData(getPlayerAcc, "AchEarned", AchEarned) -- Achievements earned
  256. setAccountData(getPlayerAcc, "AchPoints", AchPoints) -- Achievement points
  257. setAccountData(getPlayerAcc, "Ach1", Ach1) -- Ach #1
  258. setAccountData(getPlayerAcc, "Ach2", Ach2) -- Ach #2
  259. setAccountData(getPlayerAcc, "Ach3", Ach3) -- Ach #3
  260. setAccountData(getPlayerAcc, "Ach4", Ach4) -- Ach #4
  261. setAccountData(getPlayerAcc, "Ach5", Ach5) -- Ach #5
  262. -- NO ANYMORE SET STATS ANYMORE
  263. setAccountData(getPlayerAcc, "AddSQL", "1.1")
  264. outputChatBox("* #FFFFFF" .. getPlayerName( source ) .. "#0fc0fc has logged in and he's ready to play for the first time!", getRootElement(), 255, 255, 255, true)
  265. -- Anti-Guest
  266. setElementData(source, "data.guest", "true")
  267. -- Updated
  268. setElementData(source, "data.rank", Rank)
  269. setElementData(source, "data.wins", Wins)
  270. setElementData(source, "data.lost", Losers)
  271. setElementData(source, "data.points", Points)
  272. setElementData(source, "data.cash", Cash)
  273. setElementData(source, "data.exp", Exp)
  274. setElementData(source, "data.achearned", AchEarned)
  275. setElementData(source, "data.achpoints", AchPoints)
  276. setElementData(source, "data.ach1", Ach1)
  277. setElementData(source, "data.ach2", Ach2)
  278. setElementData(source, "data.ach3", Ach3)
  279. setElementData(source, "data.ach4", Ach4)
  280. setElementData(source, "data.ach5", Ach5)
  281. end
  282. end
  283. addEventHandler("onPlayerLogin", getRootElement(), Logged)
  284.  
  285. function Logouted()
  286. setElementData(source, "data.guest", "false")
  287. end
  288. addEventHandler("onPlayerLogout",getRootElement(),Logouted)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement