indivisually setting a material?

Hello, I have different icons for my HUD and I was wondering whether I can individually set the material, an example is below:

[lua]
if (food <= 100 and food > 75) then
surface.SetMaterial(hunger100)
else if (food == 75 and food > 50) then
surface.SetMaterial(hunger75)
else if (food == 50 and food > 25) then
surface.SetMaterial(hunger50)
else if (food == 25 and food > 0) then
surface.SetMaterial(hunger25)
else if (food == 0) then
surface.SetMaterial(hunger0)
end
end
end
end
end
[/lua]

that code works, but it globally sets the material, which means all of the other icons do as well, is there a way to just change the icon individually for that variable?

Set the material immediately before you draw textured rect. I’m not really sure what you’re asking…

Show the rest of the code, I am quite certain that your variable “food” isn’t local.

The thirst and hunger icons also appear as the coin icon

[editline]26th June 2015[/editline]

I mean is there a way for that if statement to take effect, only to that one line for example, is there a way for the if statement to only take effect here:

ICON Cash: 0

and not globally

[editline]26th June 2015[/editline]

Also, what is the best way to refer to the player on the serverside?

sorry for the bump