Re: Re: Re: calculate

From Innocent Terrapin, 10 Years ago, written in Lua, viewed 779 times. This paste is a reply to Re: Re: calculate from Bistre Matamata - go back
URL https://paste.godclan.hu/view/0ontxgmD/diff Embed
Viewing differences between Re: Re: calculate and Re: Re: Re: calculate
local hunterShootPoints = 10
local DDwin = 1
local V = 10 -- csak egy beallitas, kesobb lehet jobb lenne allitani

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 = 1
        else
            points =  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 = DDwin math.round(DDwin * log2 (3*pc/(4*rank - 2))

2)), 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(time/avgTime, 2)
    end
    return points
end

function felvetteAHuntertDMen(time)
        if (avgTime == 0 or varTime == 0 or time < avgTime)
            points = 1
        else
            points =  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: 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