Jump to content

nvm


John Smith

Recommended Posts

John, please don't remove your posts. It's really selfish. Tell us how you fixed the issue. It may be helpful to others.

i havent removed them, but edited them.

i have edited my post so that people wouldn't reply to it as i have solved the problem while there were no replies

anyway as you request i have had a problem with tables considering assigning something depending on something

but i have fixed it and used string.find feature to look through the table and got it like this

like this

arenaDimensions = { 
{"Zombie",0}, 
{"Freeroam",2}, 
{"Sumo",3}, 
{"Paintball",4}, 
{"Advanced Warfare",5}, 
{"Demolition",6}, 
{"Capture The Flag",7}, 
{"Capture The Vehicle",8}, 
{"Hide N Seek",9}, 
{"RPG",10}, 
{"Assassin",11}, 
{"Gun Game",12}, 
{"Lobby",9835}, 
} 
  
function applyDimensionOnStart() 
local arenaData = getElementData(source,"arena") 
   for i,room in ipairs(arenaDimensions) do -- loop the table 
    if string.find(room[1],arenaData) then -- if our element data is in table(e.g "Freeroam")  
        outputChatBox("found data") -- let us know on chat 
        setElementDimension(source,room[2]) -- set our dimension (data 2 in the table(number)) 
        outputChatBox(tostring(room[2])) -- let us know about our dimension number 
    end 
   end 
end 
addEventHandler("onPlayerSpawn",root,applyDimensionOnStart) 

so i have a resource which changes my element data(by clicking my own buttons)

and if my data of arena is "Freeroam", when i spawn it will look in the table to which dimension it should put me in

and thats number 2

so when i spawn it's gonna give me 2nd dimension because my element data is "Freeroam"

i can't really write what i've fixed as i deleted the whole code and started again to write it(from function till the event handler)

Link to comment

Cool. Try just post a new reply saying you've fixed it and how in the future. Not trying to be an asshole or anything but I just find that it would help others if you didn't edit your posts. If everyone does that then what is the point of having an archive and search on these forums. Again, not trying to be an arse, I just hope you understand. Thanks for explaining the issue you had.

Link to comment

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