Kazafka Posted January 3, 2020 Share Posted January 3, 2020 (edited) I dont't really know what i've did here not valid, but please tell me: enableGarageFunctions = {} --XML file sets that table to "Y" --And string.match doesn't matches "Y" with table, that have inserted only "Y" in it for k, v in ipairs(enableGarageFunctions) do if(string.match("Y", v)) then --some code end end What's wrong? I tried even to do this in XML file (I doubled "Y"): <list> <garage> <condition enable="Y"/> <condition enable="Y"/> </garage> <taser> <condition enable="Y"/> <condition enable="Y"/> </taser> </list> But even this doesn't work. Tell me, what I'm doing w r o n g. I don't know what I did w r o n g for real. Edited January 3, 2020 by VaporZ Link to comment
Moderators IIYAMA Posted January 3, 2020 Moderators Share Posted January 3, 2020 12 minutes ago, VaporZ said: What's wrong? I tried even to do this in XML file (I doubled "Y"): Your table is empty, we can't validate that. Fill it up and than use this to visualise it: outputConsole ( inspect(enableGarageFunctions)) Open console (f8) Link to comment
Kazafka Posted January 3, 2020 Author Share Posted January 3, 2020 2 minutes ago, IIYAMA said: Your table is empty, we can't validate that. Fill it up and than use this to visualise it: outputConsole ( inspect(enableGarageFunctions)) Open console (f8) In console, it outputs: { "Y" } start: Resource 'policja' started 2 minutes ago, IIYAMA said: Your table is empty, we can't validate that. Fill it up and than use this to visualise it: outputConsole ( inspect(enableGarageFunctions)) Open console (f8) In console, it outputs: { "Y" } start: Resource 'policja' started /\ 'police' I tried to: if(enableGarageFunctions[1] == "Y") then --some code end Still nothin' IIYAMA's typing still lol dude thats long xd I don't know how it could be empty Link to comment
Kazafka Posted January 3, 2020 Author Share Posted January 3, 2020 IDK how it's not matching, because: policevehs = {} --XML sets that table to: {"596, "523", "402"} for k, v in ipairs(policevehs) do if(string.match(getElementModel(player), tonumber(v))) then --PLAYER IS VEHICLE!!! --some code end end and thats ok lol What u can say IIYAMA enableGarageFunctions IDK why its empty After XML sets it Link to comment
Moderators IIYAMA Posted January 3, 2020 Moderators Share Posted January 3, 2020 49 minutes ago, VaporZ said: IDK how it's not matching, because: Keep it simple. if getElementModel(player) == tonumber(v) then break -- stop the loop when result end Link to comment
Kazafka Posted January 4, 2020 Author Share Posted January 4, 2020 1 hour ago, IIYAMA said: Keep it simple. if getElementModel(player) == tonumber(v) then break -- stop the loop when result end ok, but for me, my ways to do stuff are most understandable, until Im working with other people. Anyways, I will try to work with this table (enableGarageFunctions) today, maybe after 10 o'clock am, and I will show results in other topic. Thank you for the time, that you spent on this topic. See ya! 1 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