AGENT_STEELMEAT Posted February 11, 2011 Share Posted February 11, 2011 I am (heavily) editing a pay'n'spray script, and want to check that a car is not of a certain model. I was hoping I could check it against a table, but I can't seem to come up with the proper syntax. Any help would be appreciated. Here is the code I need help with: --the table local notAllowed = {509, 481, 510, 485, 574, 420, 552, 416, 433, 490, 528, 407, 544, 523, 470, 598, 596, 597, 599, 432, 601, 428, 532, 578, 486, 406] --then, after the source is for sure a car with a ped in it, check it with: if (getElementModel(hitElement) ~= --what goes here? lol --if it is, continue. if not, output a message to the chatbox. Link to comment
Deltanic Posted February 11, 2011 Share Posted February 11, 2011 if notAllowed[getElementModel(hitElement)] then outputChatBox ( "That vehicle is not allowed!" ) end That should it be. Link to comment
Aibo Posted February 11, 2011 Share Posted February 11, 2011 if notAllowed[getElementModel(hitElement)] then outputChatBox ( "That vehicle is not allowed!" ) end That should it be. nope, because right now id's are values, not keys, like notAllowed[1] = 509. local notAllowed = { [509] = true, [481] = true } -- etc if notAllowed[getElementModel(hitElement)] then outputChatBox ( "That vehicle is not allowed!" ) end Link to comment
Deltanic Posted February 11, 2011 Share Posted February 11, 2011 oh, so it was >_> next time, I have to listen better to my brain Link to comment
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