Re: Re: Re: Re: calculate

From Coral Human, 10 Years ago, written in Lua, viewed 894 times. This paste is a reply to Re: Re: Re: calculate from Innocent Terrapin - view diff
URL https://paste.godclan.hu/view/-WTG-RPM Embed
Download Paste or View Raw
  1. local hunterShootPoints = 10
  2. local DDwin = 10
  3. local V = 10 -- csak egy beallitas, kesobb lehet jobb lenne allitani
  4. local mult = 10
  5.  
  6. local avgTime = 0
  7. local varTime = 0
  8.  
  9. function calledWhenRaceStarts()
  10.     if mysql_query(handler, "SELECT COUNT(*) FROM tops WHERE this_is_this_map") == (1 or 0) then
  11.         -- Ha 1 top van csak, nincs variancia, szal az se jo
  12.         avgTime = 0
  13.         varTime = 0
  14.         return
  15.     end
  16.  
  17.     local result = mysql_query(handler, "SELECT AVG(time) FROM tops WHERE this_is_this_map")
  18.     avgTime = toNumber(result)
  19.  
  20.     local result = mysql_query(handler, "SELECT VAR_POP(time) FROM tops WHERE this_is_this_map")
  21.     varTime = toNumber(result)
  22. end
  23.  
  24. function calculatePoints(rank, pc, mode, time)
  25.     if not pc then pc = g_playerCount end
  26.     if not mode then mode = g_mode end
  27.     local points
  28.     if mode == 1 then -- Race
  29.         if (avgTime == 0 or varTime == 0 or time < avgTime)
  30.             points = mult
  31.         else
  32.             points =  math.round(mult*exp((time - avgTim)^2 / (2 * V * varTime)))
  33.         end
  34.     elseif mode == 2 then -- DD
  35.  
  36.         -- Gyakorlatilag atlagosan annyi pontot kap igy vki, ahany embert lokott le, ugy normalva, hogy ha nyer, kap DDwin*lelokott pontot. Nem mindig ad annyit, csak atlagosan nehany kor alatt elvileg. A campelokkel szemben nem mukodik, aki campel, es elfut a game elol, az tobb pontot kap igy mint amennyit megerdemel.
  37.  
  38.         points = math.round(DDwin * log2 (3*pc/(4*rank - 2)))
  39.  
  40.     elseif mode == 3 then -- DM
  41.  
  42.         -- Meghalt DM-en hunter elott, itt is fuggetlenek a jatekosok, szal csak az idotol fugg a pont
  43.  
  44.         points = math.round(mult*time/avgTime, 2)
  45.     end
  46.     return points
  47. end
  48.  
  49. function felvetteAHuntertDMen(time)
  50.         if (avgTime == 0 or varTime == 0 or time < avgTime)
  51.             points = mult
  52.         else
  53.             points =  math.round(mult*exp((time - avgTim)^2 / (2 * V * varTime)))
  54.         end
  55. end
  56.  
  57. function lelottEgyHuntertAHunterrelDMen()
  58.     -- Le lehet loni magadat valahogy? Ha igen erdemes figyelni azt is.
  59.     -- Azert sztem ne kapjn penzt, ha hunterrel autot lo le.
  60.     -- Be kell allitani, hogy a hunterek kozott ne lehessen a carhide-t hasznalni, nemtom most hogy van.
  61.     points = hunterShootPoints
  62. end

Replies to Re: Re: Re: Re: calculate rss

Title Name Language When
Re: Re: Re: Re: Re: calculate Tinct Prairie Dog lua 10 Years ago.

Reply to "Re: Re: Re: Re: calculate"

Here you can reply to the paste above