Rhaleron Posted February 24, 2017 Share Posted February 24, 2017 Az a gond hogy aki megnyeri a kört nem kapja meg a pontot és money-t. Ha valaki tudna segíteni megköszönném! -------------- -- Race winner -------------- LastWinners={} addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function (winner) local account = getPlayerAccount(winner) if not (isGuestAccount(account)) then if getPlayerCount() >= 3 then local WinStreak = 0 local thePlayer = winner LastWinners[20] = LastWinners[19] LastWinners[19] = LastWinners[18] LastWinners[18] = LastWinners[17] LastWinners[17] = LastWinners[16] LastWinners[16] = LastWinners[15] LastWinners[15] = LastWinners[14] LastWinners[14] = LastWinners[13] LastWinners[13] = LastWinners[12] LastWinners[12] = LastWinners[11] LastWinners[11] = LastWinners[10] LastWinners[10] = LastWinners[9] LastWinners[9] = LastWinners[8] LastWinners[8] = LastWinners[7] LastWinners[7] = LastWinners[6] LastWinners[6] = LastWinners[5] LastWinners[5] = LastWinners[4] LastWinners[4] = LastWinners[3] LastWinners[3] = LastWinners[2] LastWinners[2] = LastWinners[1] LastWinners[1] = thePlayer if LastWinners[1] == thePlayer then WinStreak = 1 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer then WinStreak = 2 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer then WinStreak = 3 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer then WinStreak = 4 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer then WinStreak = 5 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer then WinStreak = 6 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer then WinStreak = 7 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer then WinStreak = 8 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer then WinStreak = 9 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer then WinStreak = 10 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer then WinStreak = 11 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer then WinStreak = 12 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer then WinStreak = 13 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer and LastWinners[14] == thePlayer then WinStreak = 14 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer and LastWinners[14] == thePlayer and LastWinners[15] == thePlayer then WinStreak = 15 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer and LastWinners[14] == thePlayer and LastWinners[15] == thePlayer and LastWinners[16] == thePlayer then WinStreak = 16 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer and LastWinners[14] == thePlayer and LastWinners[15] == thePlayer and LastWinners[16] == thePlayer and LastWinners[17] == thePlayer then WinStreak = 17 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer and LastWinners[14] == thePlayer and LastWinners[15] == thePlayer and LastWinners[16] == thePlayer and LastWinners[17] == thePlayer and LastWinners[18] == thePlayer then WinStreak = 18 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer and LastWinners[14] == thePlayer and LastWinners[15] == thePlayer and LastWinners[16] == thePlayer and LastWinners[17] == thePlayer and LastWinners[18] == thePlayer and LastWinners[19] == thePlayer then WinStreak = 19 if LastWinners[1] == thePlayer and LastWinners[2] == thePlayer and LastWinners[3] == thePlayer and LastWinners[4] == thePlayer and LastWinners[5] == thePlayer and LastWinners[6] == thePlayer and LastWinners[7] == thePlayer and LastWinners[8] == thePlayer and LastWinners[9] == thePlayer and LastWinners[10] == thePlayer and LastWinners[11] == thePlayer and LastWinners[12] == thePlayer and LastWinners[13] == thePlayer and LastWinners[14] == thePlayer and LastWinners[15] == thePlayer and LastWinners[16] == thePlayer and LastWinners[17] == thePlayer and LastWinners[18] == thePlayer and LastWinners[19] == thePlayer and LastWinners[20] == thePlayer then WinStreak = 20 end end end end end end end end end end end end end end end end end end end end local pAlive = getAliveRacePlayers() local pDead = getDeadRacePlayers() local WinS = tonumber(getAccountData(account,"highestWinstreak")) if WinS < WinStreak then setAccountData(account,"highestWinstreak",WinStreak) end local cashToWin = tonumber((moneyEarnPart*getPlayerCount())*WinStreak) local playerCash = tonumber(getAccountData(account,"cash")) if not (cashToWin < 0) then setAccountData(account,"cash",playerCash+cashToWin) end local points = math.floor(((pAlive + pDead)*pDead)*WinStreak) if not (points < 0) then local playerPoints = getAccountData(account,"points") setAccountData(account,"points",playerPoints+points) end addStat(account,"mapsWon",1) outputChatBox ("#00ff00* #FFFFFF" .. getPlayerName(winner) .." #FFFFFFhas won! He/She gets $#00ff00" .. tostring(cashToWin) .." #ffffffand #00ff00"..points.."#ffffff points || x"..WinStreak.."#00ff00!",getRootElement(),255,255,255,true) triggerClientEvent("Streaktext", root, WinStreak) --setTimer ( function(WinStreak)end, 100, 1 ) scoreboardRefresh(winner) unlockAchievement(winner) unlockAchievement(winner,12) else outputChatBox("#00ff00* #FFFFFFNot enough players to earn money - #00ff003 #FFFFFFrequired.",winner,255,255,255,true) end callClientFunction(winner,"deathReset") local thePlayer = winner scoreboardRefresh(thePlayer) end end) Link to comment
pa3ck Posted May 5, 2017 Share Posted May 5, 2017 Tudom, hogy ez mar jo regi topic, de ez a kod hihetetlenul csunyan let ossze rakva. Ezt 2-3 loopal is meglehetett volna oldani... probalj mindig arra torekedni, hogy a kodban ne legyen ismetles, foleg annyiszor ahanyszor ebben van.. 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