Need Help with Gmods Hide N SEEK Script

Hello, I’m creating an hide n seek scrip on which I can scale the players on each team.
I’m having a problem with the


s = ply:GetModelScale()

on each round he gets the new scale. for example. if after the first round my char is twice as big, on the next round the scale of the other team will apply in my twice as big char insted of the original model. that means that after each round my player model will become bigger.
Anyone knows how to get the original player model scale, insted of using


GetModelScale()

that gets the current one?
Reseting the models after each round will work as well but i have no clue how to do that as well confused_rev emoticon
This is my script by the way:




s = ply:GetModelScale()
local function manipulate(ply)
if not (IsValid(ply)) then
return
end
s = ply:GetModelScale()
local t = ply:Team()
if (t == 1) then
--Midget Version
--Head
ply:ManipulateBoneScale(ply:LookupBone("ValveBiped.Bip01_Head1"), Vector(2,2,2))
--ESCALA
ply:SetModelScale(s * 0.5, 0 )

elseif (t == 2) then
--Normal Version
--Head
ply:ManipulateBoneScale(ply:LookupBone("ValveBiped.Bip01_Head1"), Vector(1,1,1))
ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_Head1"), Vector(0,0,0))
--Pelvis
ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_Pelvis"), Vector(0,0,0))
--L UpperArm
ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_L_UpperArm"), Vector(0,0,0))
--R UpperArm
ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_R_UpperArm"), Vector(0,0,0))
--L Thigh
ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_L_Thigh"), Vector(0,0,0))
--R Thigh
ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_R_Thigh"), Vector(0,0,0))
--ESCALA
ply:SetModelScale(s * 2, 0 )
end
end
hook.Add("HASPlayerCaught", "Bone Manipulation", function(seeker, hider)
manipulate(hider)
end)
hook.Add("HASRoundStarted", "Bone Manipulation", function()
for k, ply in pairs(player.GetAll()) do
manipulate(ply)
end
end)

Original model scale is always 1.0, if that’s what you’re asking. SetModelScale multiplies default scale by x amount, default * 1 = default.

Ik its offtopic but you using the hide and seek gamemode for your server ? if yes where did you get the gamemode working ?

in that case should i change


ply:SetModelScale(ply:GetModelScale() * 0.5, 0 )

to


ply:SetModelScale(1 * 0.5, 0 )

?

why didn’t I though of this O.o ty mate, I will test it out

http://s7.postimg.org/wnjh6bd3v/2016_02_18_00002.jpg

worked now i have a new problem

changed this on the seekers,


       --L Thigh
		ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_L_Thigh"), Vector(30,0,0))

		--R Thigh
		ply:ManipulateBonePosition(ply:LookupBone("ValveBiped.Bip01_R_Thigh"), Vector(-30,0,0))

mewtwo started in that team so the bone manipulation looked like garbish, sonic was caught after and it looks perfect.

I noticed this happens because the model is applied after the bone manipulation, insted of the other way arround.

that’s why sonic (who’s model has already been aplied) bone positions correctly.

when I don’t use a player model it works as well and that confirms my theory :v

any ideas on how to fix this?

Well, you could check for the player’s model changing and set the bones after that.

this is my first time using LUA so… I have no idea on how to use checks. could you help me out with the coding it self?

I’m fairly sure there isn’t a hook for when a player changes playermodel, so you could hook PlayerTick or something and check if their model this tick differs from their model last tick; if so run the code.

[editline]18th February 2016[/editline]

something like
[lua]
hook.Add(“PlayerTick”, “Check for models and set bones”, function(ply)
if ply:GetModel() ~= ply.lastmodel then
– trigger the bone change
end
ply.lastmodel = ply:GetModel()
end)
[/lua]

could not get it to work… any other ideas? :confused: