SirniNamaz Posted September 7, 2012 Share Posted September 7, 2012 i am trying to make a mission framework for mta sa (single/co-op).. so my question is this: if i create one client file with this code: createMission("Mission One","MissionOneMarkersName") (i have the client function createMission) i want it to create marker which name/variable will be "MissionOneMarkersName" or whatever i put on the createMission function name when i use it in the code. Link to comment
AMARANT Posted September 7, 2012 Share Posted September 7, 2012 You can pass in custom functions any arguments you want. Link to comment
SirniNamaz Posted September 7, 2012 Author Share Posted September 7, 2012 you didnt understand.. in one variable there is a string which i want it to be the name/variable of a marker example: varVariable="myMarker", then to create marker which variable is myMarker Link to comment
AMARANT Posted September 7, 2012 Share Posted September 7, 2012 And what's the problem? You can't name a marker but you can set its element data. Pass required arguments and do it. Link to comment
SirniNamaz Posted September 7, 2012 Author Share Posted September 7, 2012 not the name, the variable: for examle if i do this varSomething = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 ) it will create marker named 'varSomething' but varSomething contains a string/text which is 'mrkSomething' and i want it to create a marker which's variable is the string inside varSomething Link to comment
AMARANT Posted September 7, 2012 Share Posted September 7, 2012 I don't understand why you need this... When you set some variable you have to name it yourself and it can't be named automatically from some string or something. Link to comment
SirniNamaz Posted September 7, 2012 Author Share Posted September 7, 2012 never mind, i found another solution, the only thing i want to know is if it is possible to create more markers under same variable/name and, how to add some kind of identifier/description/tag or something to marker. Link to comment
AMARANT Posted September 7, 2012 Share Posted September 7, 2012 Of course it's possible. Just use lua tables. Link to comment
SirniNamaz Posted September 7, 2012 Author Share Posted September 7, 2012 and aslo how to add some kind of identifier/description/tag or something to marker. Link to comment
AMARANT Posted September 7, 2012 Share Posted September 7, 2012 Here's an example: myMarker={} for i=1,10 do myMarker[i]=createMarker(1000+i,2000+i,15,"cylinder",2,255,0,0,125) end Link to comment
SirniNamaz Posted September 7, 2012 Author Share Posted September 7, 2012 ok, thx, for that but i have another question.. how do i make same thing you wrote just now, but if i dont know how many i's will there be, and also does area between [] have to be a number Link to comment
AMARANT Posted September 7, 2012 Share Posted September 7, 2012 'Area' in '[]' is a key. Marker will be a value. All of them will be a table. You can set anything in '[]' brackets but if you want to create several markers then you obviously need numbers because it's easier to get them in the future. Anyway you can set anything you want as a key. Link to comment
Anderl Posted September 7, 2012 Share Posted September 7, 2012 To create a marker using a string variable as its variable name just do that: _G[variableName] = createMarker(...) --or loadstring(variableName .. ' = createMarker(...)')() 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