Jump to content

big problem with variables!! need help!!


SirniNamaz

Recommended Posts

Posted

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.

Posted

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

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

'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.

Posted

To create a marker using a string variable as its variable name just do that:

_G[variableName] = createMarker(...) 
  
--or 
  
loadstring(variableName .. ' = createMarker(...)')() 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...