Update 'Example_StatPointUI/Server/StatPointUI.lua'
This commit is contained in:
@ -38,6 +38,15 @@ function StatPointUI.OnLogin(event, player)
|
|||||||
StatPointUI.SetStats(player:GetGUIDLow())
|
StatPointUI.SetStats(player:GetGUIDLow())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function StatPointUI.AddStatPoint(guid)
|
||||||
|
local player = GetPlayerByGUID(guid)
|
||||||
|
if(player) then
|
||||||
|
StatPointUI.cache[guid][6] = StatPointUI.cache[guid][6]+1
|
||||||
|
CharDBQuery("UPDATE character_stats_extra SET `points`=`points`+1 WHERE `guid`="..guid..";")
|
||||||
|
player:SendServerResponse(config.Prefix, 1, StatPointUI.cache[guid])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function StatPointUI.SetStats(guid, stat)
|
function StatPointUI.SetStats(guid, stat)
|
||||||
stat = stat or nil
|
stat = stat or nil
|
||||||
local player = GetPlayerByGUID(guid)
|
local player = GetPlayerByGUID(guid)
|
||||||
@ -121,6 +130,11 @@ function OnStatResetRequest(player, argTable)
|
|||||||
player:SendServerResponse(config.Prefix, 1, StatPointUI.cache[player:GetGUIDLow()])
|
player:SendServerResponse(config.Prefix, 1, StatPointUI.cache[player:GetGUIDLow()])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Helper function to add a stat point to the player through other scripts
|
||||||
|
function Player:AddPoint()
|
||||||
|
StatPointUI.AddStatPoint(self:GetGUIDLow())
|
||||||
|
end
|
||||||
|
|
||||||
RegisterPlayerEvent(3, StatPointUI.OnLogin)
|
RegisterPlayerEvent(3, StatPointUI.OnLogin)
|
||||||
RegisterServerEvent(33, StatPointUI.OnElunaStartup)
|
RegisterServerEvent(33, StatPointUI.OnElunaStartup)
|
||||||
RegisterClientRequests(config)
|
RegisterClientRequests(config)
|
||||||
Reference in New Issue
Block a user