Re: Re: Re: calculate

From Innocent Terrapin, 10 Years ago, written in Lua, viewed 872 times. This paste is a reply to Re: Re: calculate from Bistre Matamata - view diff
URL https://paste.godclan.hu/view/0ontxgmD Embed
Download Paste or View Raw
  1. local hunterShootPoints = 10
  2. local DDwin = 1
  3. local V = 10 -- csak egy beallitas, kesobb lehet jobb lenne allitani
  4.  
  5. local avgTime = 0
  6. local varTime = 0
  7.  
  8. function calledWhenRaceStarts()
  9.     if mysql_query(handler, "SELECT COUNT(*) FROM tops WHERE this_is_this_map") == (1 or 0) then
  10.         -- Ha 1 top van csak, nincs variancia, szal az se jo
  11.         avgTime = 0
  12.         varTime = 0
  13.         return
  14.     end
  15.  
  16.     local result = mysql_query(handler, "SELECT AVG(time) FROM tops WHERE this_is_this_map")
  17.     avgTime = toNumber(result)
  18.  
  19.     local result = mysql_query(handler, "SELECT VAR_POP(time) FROM tops WHERE this_is_this_map")
  20.     varTime = toNumber(result)
  21. end
  22.  
  23. function calculatePoints(rank, pc, mode, time)
  24.     if not pc then pc = g_playerCount end
  25.     if not mode then mode = g_mode end
  26.     local points
  27.     if mode == 1 then -- Race
  28.         if (avgTime == 0 or varTime == 0 or time < avgTime)
  29.             points = 1
  30.         else
  31.             points =  exp((time - avgTim)^2 / (2 * V * varTime))
  32.         end
  33.     elseif mode == 2 then -- DD
  34.  
  35.         -- 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.
  36.  
  37.         points = math.round(DDwin * log2 (3*pc/(4*rank - 2)), 2)
  38.  
  39.     elseif mode == 3 then -- DM
  40.  
  41.         -- Meghalt DM-en hunter elott, itt is fuggetlenek a jatekosok, szal csak az idotol fugg a pont
  42.  
  43.         points = math.round(time/avgTime, 2)
  44.     end
  45.     return points
  46. end
  47.  
  48. function felvetteAHuntertDMen(time)
  49.         if (avgTime == 0 or varTime == 0 or time < avgTime)
  50.             points = 1
  51.         else
  52.             points =  exp((time - avgTim)^2 / (2 * V * varTime))
  53.         end
  54. end
  55.  
  56. function lelottEgyHuntertAHunterrelDMen()
  57.     -- Le lehet loni magadat valahogy? Ha igen erdemes figyelni azt is.
  58.     -- Azert sztem ne kapjn penzt, ha hunterrel autot lo le.
  59.     -- Be kell allitani, hogy a hunterek kozott ne lehessen a carhide-t hasznalni, nemtom most hogy van.
  60.     points = hunterShootPoints
  61. end

Replies to Re: Re: Re: calculate rss

Title Name Language When
Re: Re: Re: Re: calculate Coral Human lua 10 Years ago.

Reply to "Re: Re: Re: calculate"

Here you can reply to the paste above