Re: Re: Re: Re: calculate
local hunterShootPoints = 10
local DDwin = 10
local V = 10 -- csak egy beallitas, kesobb lehet jobb lenne allitani
local mult = 10
local avgTime = 0
local varTime = 0
function calledWhenRaceStarts()
if mysql_query(handler, "SELECT COUNT(*) FROM tops WHERE this_is_this_map") == (1 or 0) then
-- Ha 1 top van csak, nincs variancia, szal az se jo
avgTime = 0
varTime = 0
return
end
local result = mysql_query(handler, "SELECT AVG(time) FROM tops WHERE this_is_this_map")
avgTime = toNumber(result)
local result = mysql_query(handler, "SELECT VAR_POP(time) FROM tops WHERE this_is_this_map")
varTime = toNumber(result)
end
function calculatePoints(rank, pc, mode, time)
if not pc then pc = g_playerCount end
if not mode then mode = g_mode end
local points
if mode == 1 then -- Race
if (avgTime == 0 or varTime == 0 or time < avgTime)
points = mult
else
points = math.round(mult*exp((time - avgTim)^2 / (2 * V * varTime)))
end
elseif mode == 2 then -- DD
-- 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.
points = math.round(DDwin * log2 (3*pc/(4*rank - 2)))
elseif mode == 3 then -- DM
-- Meghalt DM-en hunter elott, itt is fuggetlenek a jatekosok, szal csak az idotol fugg a pont
points = math.round(mult*time/avgTime, 2)
end
return points
end
function felvetteAHuntertDMen(time)
if (avgTime == 0 or varTime == 0 or time < avgTime)
points = mult
else
points = math.round(mult*exp((time - avgTim)^2 / (2 * V * varTime)))
end
end
function lelottEgyHuntertAHunterrelDMen()
-- Le lehet loni magadat valahogy? Ha igen erdemes figyelni azt is.
-- Azert sztem ne kapjn penzt, ha hunterrel autot lo le.
-- Be kell allitani, hogy a hunterek kozott ne lehessen a carhide-t hasznalni, nemtom most hogy van.
points = hunterShootPoints
end
Replies to Re: Re: Re: Re: calculate
{"text":"text","html5":"html","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"lua","bash":"sh","erlang":"erlang","go":"golang","c":"c_cpp","cpp":"c_cpp","diff":"diff","latex":"latex","sql":"sql","xml":"xml","0":"text","abap":"abap","actionscript":"actionscript","actionscript3":"actionscript","ada":"ada","apache":"apache_conf","applescript":"applescript","asm":"assembly_x86","autohotkey":"autohotkey","closure":"closure","cobol":"cobol","coffeescript":"coffee","cpp-winapi":"c_cpp","c_loadrunner":"c_cpp","c_mac":"c_cpp","c_winapi":"c_cpp","csharp":"csharp","d":"d","dart":"dart","dot":"dot","eiffel":"eiffel","fortran":"fortran","groovy":"groovy","haskell":"haskell","haxe":"haxe","ini":"ini","io":"io","java":"java","java5":"java","make":"makefile","matlab":"matlab","mysql":"mysql","objc":"objectivec","ocaml":"ocaml","pascal":"pascal","perl":"perl","perl6":"perl","postgresql":"pgsql","powershell":"powershell","prolog":"prolog","properties":"properties","rails":"ruby","rust":"rust","scala":"scala","scheme":"scheme","smarty":"smarty","tcl":"tcl","vala":"vala","vb":"vbscript","verilog":"verilog","vhdl":"vhdl","yaml":"yaml"}