Pointshop help and Setting player model

Hi there, I’ve been struggling to do a few things with my pointshop. Firstly giving double points to someone with our tag in [PxG], here is what I have so far;


 
    if PS.Config.PointsOverTime then
          timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
               PS.Config.PointsOverTimeAmount
                   if string.find(self:Nick(), "[PxG]", 1, true) then
                    PS.Config.PointsOverTimeAmount = PS.Config.PointsOverTimeAmount*2
                  end 
            end) 
     end 


Secondly due to hat positioning I am trying to set it so only one player model is selected upon round start (cs_phoenix)


 
hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function()
    for k,v in pairs(player.GetAll()) do
        if v:SetModel(Model("player/phoenix.mdl")) end
    end
end) 


Thanks in advance.

hey it would help if you posted the errors it gave you like the obvious syntax error in the first one.

[lua] if PS.Config.PointsOverTime then
timer.Create(‘PS_PointsOverTime_’ … self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
– PS.Config.PointsOverTimeAmount – this will syntax error
– if string.find(self:Nick(), “[PxG]”, 1, true) then – this isn’t how you use string.find
if string.find(self:Nick(), “[PxG”]) != nil then – string.find returns a position or nil if not found.
– PS.Config.PointsOverTimeAmount = PS.Config.PointsOverTimeAmount*2 – this changes a global, which is bad!

           end 
        end) 
 end[/lua]

you know what it’ll be easier if we just start with the original function

[lua] if PS.Config.PointsOverTime then
timer.Create(‘PS_PointsOverTime_’ … self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
if !IsValid(self) then return end
local amount = PS.Config.PointsOverTimeAmount
if string.find(self:Nick(), “[PxG”]) != nil then amount = amount * 2 end
self:PS_GivePoints(amount)
self:PS_Notify("You’ve been given ", amount, " “, PS.Config.PointsName, " for playing on the server!”)
end)
end[/lua]

as for the player models, we kind of override the gamemode’s choosing of the model, maybe just fix the hat positioning on models instead of trying to limit the player from having a different model?

Thanks for the reply, Matt. And sure thing, I’ve positioned our hats and will just continue using random plyermodels. Thanks again.

With the player model thing, the hook isn’t really needed.

Spent a moment to think about your problems/errors, somewhere TTT must be setting your model. Take a look inside your shared.lua and there’ll be a table of CSS characters, one of which is randomly picked when the round starts as the player model, that can be changed to as many or as little as you’d like.

Thanks for the suggestion, I scrapped the idea but decided to have a look anyway. Line 271 of gamemodes/terrortown/gamemode/player_ext.lua seemed to do the trick. Thanks allot both of you.