Okay i'm making a gamemode that will require a points/credits system similar to TTT for the traitors equipment shop, i was just wondering what the best way of doing this would be.
My initial idea was to try and make it all client-side but though that might cause problems when needing to tell the server how many points a player has, then I thought I could do it server-side which would work but i would need to constantly send the amount of credits to the client to update the HUD/Menus
It should work similar to Money in most RP gamemodes where every few minutes/seconds the player will receive more credits.
How are these systems usually made?
Just looked at the wiki for the NetworkedVars im assuming i would set them on the player?
Edit:
Okay after more reading I think i understand this, Thank you :) im new to Lua and this has opened up so many more possibilities for me with my ideas
[QUOTE=Spero78;31975742]im new to Lua and this has opened up so many more possibilities for me with my ideas[/QUOTE]
Haha I know, I just started scripting other things besides simple client sided stuff a few months ago and it really does open more possibilities.
DONT USE NWINTS OR NETWORKED VARIABLES AT ANY COST they are laggy as hell and pretty much unoptimised
[QUOTE=werewolf0020;31976282]DONT USE NWINTS OR NETWORKED VARIABLES AT ANY COST they are laggy as hell and pretty much unoptimised[/QUOTE]
What should we use?
[lua]
--- Equipment credits
function plymeta:SetCredits(amt)
self.equipment_credits = amt
self:SendCredits()
end
function plymeta:AddCredits(amt)
self:SetCredits(self:GetCredits() + amt)
end
function plymeta:SubtractCredits(amt) self:AddCredits(-amt) end
function plymeta:SetDefaultCredits()
if self:GetTraitor() then
local c = GetConVarNumber("ttt_credits_starting")
if CountTraitors() == 1 then
c = c + GetConVarNumber("ttt_credits_alonebonus")
end
self:SetCredits(math.ceil(c))
elseif self:GetDetective() then
self:SetCredits(math.ceil(GetConVarNumber("ttt_det_credits_starting")))
else
self:SetCredits(0)
end
end
function plymeta:SendCredits()
umsg.Start("credits", self)
umsg.Char(self:GetCredits())
umsg.End()
end
[/lua]
Thats how TTT does it, I might try something simmilar
You can just steal PEZ's shop :v:
Its not a shop though, its more like resources in an RTS except they increase automatically
[QUOTE=Spero78;31977591][lua]
--Code
[/lua]
Thats how TTT does it, I might try something simmilar[/QUOTE]
Oh yea that uses meta tables
Sorry, you need to Log In to post a reply to this thread.