No categories assigned

LUA:GetServerVariable

Revision as of 23:33, 8 July 2015 by Jabantiz (talk | contribs) (Created page with "{{PageHeaderChild|LUA|GetServerVariable}} == GetServerVariable() == Gets the value of the server variable == Syntax == var = GetServerVariable(param1) == Parameters == ; Requ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LUA - GetServerVariable

Return to: LUA | Tutorials | Portal | Forum | Project Manager | Bug Tracker


GetServerVariable()

Gets the value of the server variable


Syntax

var = GetServerVariable(param1)

Parameters

Required - param1 (String)
param1 is the name of the server variable to get

Returns

String

Usage

function hailed(NPC, Spawn)
    local var = tonumber(GetServerVariable("Quest1_Global_Complete_Count"))

    if var == nil or var <= 4000 then
        OfferQuest(Spawn, Quest1)
    else
        OfferQuest(Spawn, Quest2)
    end
end

This will offer the player a different quest if the server variable Quest1_Global_Complete_Count is less then or equal to 4000