Pointshop Modifactions.

Yes I am trying to decompose a Vector. to get the x y z as different numbers. Its for a pointshop item.

The Vector is actually “modifications.color”

I was thinking it was like “modifications.color.x” and change the x with y and z and so on.

Or is there a way to divide a vector?

function ITEM:Modify(modifications)
	PS:ShowColorChooser(self, modifications)
	Red = modifications.color.x/10
	Green = modifications.color.y/10
	Blue = modifications.color.z/10

When i get those values they = 0 all the time when i use them.


This is what i am trying to use it as in a different function.

Lol dont ask me why :smiley: its a secret!

Show your code.

Ya Sorry ^^u

The modifications table in that function is the original modifications, not the new ones. You need an OnModify function that receives the new modifications on the server (which is coincidentally where you would need to set colours etc for the item).

See https://github.com/adamdburton/pointshop/blob/38a430726063622c07c4dd89ce2f4b95b1f9abf9/lua/pointshop/items/trails/electric.lua#L17 for an example of how to receive the modifications, and https://github.com/adamdburton/pointshop/blob/master/lua/pointshop/items/headshatsmasks/texthat.lua#L8 for an example of how to use the modifications in a hook.

Yes i know this i got the modification to work. But right now i am trying to get the vector decomposed. Thats not all the line i am just show you an example on how i am trying to decompose it if i am correct. how can i use it in a diffrent function?

The PS colour picker sends a colour, so you need modifications.color.r, modifications.color.g, modifications.color.b, modifications.color.a.

So instead of modifications.color.x I put modifications.color.r ?

function ITEM:Modify(modifications)
	PS:ShowColorChooser(self, modifications)
	Red = modifications.color.r/10
	Green = modifications.color.g/10
	Blue = modifications.color.b/10
function ITEM:OnEquip(ply, modifications)

Now again this is an example. Not what i am writing. even though i still used the modifications.color.r… It still sees that “Red” and a 0 for some reason.

Do i have to put those some where else? or what?

[editline]13th October 2014[/editline]


Again, the ITEM:Modify function contains the old modifications, not the new ones. You’re also making up variables like ‘ent’, using local variables inside other functions, and trying to use clientside variables on the server.

function ITEM:OnEquip(ply, modifications)
ply:SetColor(modifications.color / 10) – not sure if you can divide colours but give it a go, if not, ply:SetColor(Color(modifications.color.r / 10, modifications.color.g / 10, modifications.color.b / 10))