kuwalda Posted June 6, 2014 Share Posted June 6, 2014 Hello. Story about my problem is really short and clean, so I will try to keep it like that: function triggers and random race is selected raceMap = raceAvailableForUse[math.random(#raceAvailableForUse)] this variable is used to triggerClientEvent and is passed to next function And this variable is inserted into table, so we know map name that was randomed = raceActive["participate"] = raceMap But problem starts here - how can I use this table element to make name for table to use: raceNameForMarker = raceActive["participate"] meetingPoint = createMarker ( raceNameForMarker[1], raceNameForMarker[2], raceNameForMarker[3], "checkpoint", 6, 116, 237, 5, 255 ) I hope you undestanded what I wanted to ask. If anyone have any other solutions, I would like to hear them. Link to comment
Moderators IIYAMA Posted June 6, 2014 Moderators Share Posted June 6, 2014 use at SERVER side, when it is about maps https://wiki.multitheftauto.com/wiki/GetResourceName Link to comment
kuwalda Posted June 6, 2014 Author Share Posted June 6, 2014 I don`t really undrestud what you said... Link to comment
Moderators IIYAMA Posted June 6, 2014 Moderators Share Posted June 6, 2014 I you aren't clear what you want. You are talking about getting all race maps and take a random one out of it. and then you are starting talking about a race element, which can be the race resource element that, would be more logic when you started talking about a random map. Which I just answered. Or you mean an element from that map. Which I would answer with this: local newTable = {} local raceNameForMarker = raceActive["participate"] local meetingPoint = createMarker ( raceNameForMarker[1], raceNameForMarker[2], raceNameForMarker[3], "checkpoint", 6, 116, 237, 5, 255 ) -- """"""how can I use this table element to make name for table to use:"""""" newTable[meetingPoint] = {"this is a sexy marker!"} -- store a table under an element userdata. You information is confusing, which means not much people(except me) would reply on this topic. Link to comment
kuwalda Posted June 6, 2014 Author Share Posted June 6, 2014 No, you dont understand me and I know what I want! I have race checkpoints, which are stored in tables: blueBerryRally = { } blueBerryRally[1] = { 679.20001, 312.39999, 18.9 } blueBerryRally[2] = { 588.70001, 294.60001, 17.7 } blueBerryRally[3] = { 530.29999, 249.8, 13.9 } ... blueBerryRallyReversed = { } blueBerryRallyReversed[1] = { 675.70001, 312.79999, 18.9 } blueBerryRallyReversed[2] = { 785.59998, 330.10001, 18.9 } blueBerryRallyReversed[3] = { 892.70001, 359.5, 18.9 } ... Now when I random: raceAvailableForUse = { } raceAvailableForUse[1] = "blueBerryRally" raceAvailableForUse[2] = "blueBerryRallyReversed" raceMap = raceAvailableForUse[math.random(#raceAvailableForUse)] raceActive["participate"] = raceMap it will return either blueBerryRally or blueBerryRallyReversed ,but this element is string. So when I use: local raceNameForMarker = raceActive["participate"] meetingPoint = createMarker ( raceNameForMarker[1], raceNameForMarker[2], raceNameForMarker[3], "checkpoint", 6, 116, 237, 5, 255 ) it can`t make meetingpoint, because raceActive["participate"] vaule is string. I am asking, how can I make this raceActive["participate"] a variable, so when I use it in my createMarker function, it works? Link to comment
Moderators IIYAMA Posted June 6, 2014 Moderators Share Posted June 6, 2014 blueBerryRally = { } blueBerryRally[1] = { 679.20001, 312.39999, 18.9 } blueBerryRally[2] = { 588.70001, 294.60001, 17.7 } blueBerryRally[3] = { 530.29999, 249.8, 13.9 } ... blueBerryRallyReversed = { } blueBerryRallyReversed[1] = { 675.70001, 312.79999, 18.9 } blueBerryRallyReversed[2] = { 785.59998, 330.10001, 18.9 } blueBerryRallyReversed[3] = { 892.70001, 359.5, 18.9 } local raceCheckpointTable = {["blueBerryRally"]=blueBerryRally,["blueBerryRallyReversed"]=blueBerryRallyReversed } you can convert them using another table or you can put those tables in your random table. 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