You are viewing an old version of this page. Return to the latest version.
No categories assigned
LUA:SetServerVariable
- Last edited 9 years ago by I need to Update My Profile
Revision as of 00:02, 29 July 2015 by Jabantiz (talk | contribs) (moved SetServerVariable to LUA:SetServerVariable: I screwed up when creating thse pages)
LUA - SetServerVariable
Return to: LUA | Tutorials | Portal | Forum | Project Manager | Bug Tracker
SetServerVariable()
Sets the server variable
Syntax
SetServerVariable(param1, param2, param3)
Parameters
- Required - param1 (String), param2 (String)
- param1 is the variable name
- param2 is the value to set the variable to
- Optional - param3 (String)
- param3 is the comment for the variable
Usage
function CompleteQuest(Quest, QuestGiver, Player)
GiveQuestReward(Quest, Player)
local var = tonumber(GetServerVariable("Quest1_Global_Complete_Count"))
if var == nil then
SetServerVariable("Quest1_Global_Complete_Count", "1", "Number of times Quest 1 has been completed across the server")
else
var = var + 1
SetServerVariable("Quest1_Global_Complete_Count", var)
end
end
Every time this quest is completed it will increment the server variable, if it hasn't been completed yet it will create a new server variable
Notes
In the server core "lua_" will automatically be added to the front of the name, you only need to know this if you plan to look the variable up in the DB