kuwalda Posted June 26, 2014 Posted June 26, 2014 organizacijuSkinList["teamPolice"] = { 280, 281 } if tonumber(getElementModel(thePlayer)) ~= (tonumber(organizacijuSkinList["teamPolice"][1]) or tonumber(organizacijuSkinList["teamPolice"][2])) then I am storing my organisations skin lists in table like shown above. Problem is that my if statement works only for first check. Like in simplified version, lets say player got skin 311 if 311 ~= 312 or 241 This check works only for first value (311 ~= 312), but it ignores second check (241). Why?
ServerBoss Posted June 26, 2014 Posted June 26, 2014 Show that function plz, like the entire part for that function and see what pops up in the debug window and post it
kuwalda Posted June 26, 2014 Author Posted June 26, 2014 There is no need to, because this script works, but only this line bothers me. Instead of: if tonumber(getElementModel(thePlayer)) ~= (tonumber(organizacijuSkinList["teamMehanic"][1]) or tonumber(organizacijuSkinList["teamMehanic"][2])) then I could have used: if tonumber(getElementModel(thePlayer)) ~= (tonumber(organizacijuSkinList["teamMehanic"][1]) then if tonumber(getElementModel(thePlayer)) ~= tonumber(organizacijuSkinList["teamMehanic"][2])) then But it feels wrong to me and I wanted to found out, how can I do it corectlly.
ServerBoss Posted July 8, 2014 Posted July 8, 2014 Sorry for not getting back to you, I have been busy with other jobs. Did you get this fixed?
DiSaMe Posted July 8, 2014 Posted July 8, 2014 x == y or z This expression will check if either of conditions "x == y" and "z" is true. If "z" is anything besides nil or false, the condition will be satisfied. It's the same as this expression: (x == y) or (z) If you need to check if x is equal to either y or z, you need to make it this way: x == y or x == z
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now