Jump to content

Snoozy

Members
  • Posts

    79
  • Joined

  • Last visited

Everything posted by Snoozy

  1. well that didn't work but the problem is that the one table wont accept the other table inside to access some of the other information inside the first table I don't really know why, but is there a work around?
  2. what you mean? Could you like try and explain it a bit more in details? Cause splitting both in variables then you can't like combine them afterwards?
  3. Mhm does two tables doens't work together, like when you cross the information? I just did some debugging and found this problem: outputChatBox(IntInfo[1].X,source) -- WORKING outputChatBox(IntInfo[idx].X,source) -- WORKING outputChatBox(IntInfo[BizInfo[idx].Interior].X,source) -- NOT WORKING outputChatBox(IntInfo[int].X,source) -- NOT WORKING which shows that the ones where you like use the information from BizInfo into IntInfo does not work and that's what makes the error?
  4. What you mean by not being able to use a mysql node as an key? I'm just saving information from mysql onto a table? Sorry but i'm not really getting it
  5. Well yeah it gets confusing when your dealing with tons of tables inside another tons of tables but I'm pretty sure that it's not the BizInfo cause it's used like 2 lines up where its used to check distance between player and the location of the business and it outputs that it's found and so on. With the IntInfo I did following: (maybe I've done something wrong) IntInfo = {} function loadInt() local interior = mysql_connect("******", "******", "*****, "******") if (interior) then local maxi = mysql_query(interior,"SELECT * FROM interior") if (maxi) then maxin = mysql_num_rows(maxi) if (maxin) then for idx=0, maxin do query = "SELECT * FROM interior WHERE InteriorID = '"..idx.."'" result = mysql_query(interior,query) IntInfo[idx] = {} if (result) then row = mysql_fetch_row(result) if (row) then IntInfo[idx].ID = row[1] IntInfo[idx].X = row[2] IntInfo[idx].Y = row[3] IntInfo[idx].Z = row[4] IntInfo[idx].Interior = row[5] IntInfo[idx].Name = row[6] outputServerLog("Loaded Interior -"..row[6].."-") end end mysql_free_result(result) end end end end mysql_close(interior) setElementData(getRootElement(),"IntInfo",IntInfo) end setTimer(loadInt,500, 1) at end I do the setelementdata thing as shown above. Now in the business code: IntInfo = getElementData(getRootElement(),"IntInfo") function Enter(source,key,keystate) if keystate == "down" then if getElementData(source,"BizEntered") == 0 then for idx=1, maxBiz do x,y,z = getElementPosition(source) if getDistanceBetweenPoints3D(x, y, z, BizInfo[idx].SpawnX, BizInfo[idx].SpawnY, BizInfo[idx].SpawnZ) <= 1 then outputChatBox("24/7",source) setElementPosition(source,IntInfo[BizInfo[idx].Interior].X,IntInfo[BizInfo[idx].Interior].Y,IntInfo[BizInfo[idx].Interior].Z,true) setElementInterior(source,IntInfo[BizInfo[idx].Interior].Interior) setElementData(source,"BizEntered",idx) else outputChatBox("Not in range of any biz",source) end end else if getDistanceBetweenPoints3D(x,y,z,IntInfo[BizInfo[getElementData(source,"BizEntered")].Interior].X,IntInfo[BizInfo[getElementData(source,"BizEntered")].Interior].Y,IntInfo[BizInfo[getElementData(source,"BizEntered")].Interior].Z) <= 3 then setElementPosition(source,BizInfo[getElementData(source,"BizEntered")].SpawnX,BizInfo[getElementData(source,"BizEntered")].SpawnY,BizInfo[getElementData(source,"BizEntered")].SpawnZ,true) setElementData(source,"BizEntered",0) setElementInterior(source,0) end end end end
  6. What you mean by syncing them since the BizInfo is created in that lua anyways and shouldn't be any problems with it since it's used another place in the script where it is loaded without having to set that ones elementdata if that's what you mean?
  7. I'm having this one error that I can't seem to fix, when I get to the business and press R it gives me the error: [2011-05-26 17:51:10] ERROR: boulevard\business\server.lua:56: attempt to index field '?' (a nil value) The line is: setElementPosition (source,IntInfo[bizInfo[idx].Interior].X,IntInfo[bizInfo[idx].Interior].Y,IntInfo[bizInfo[idx].Interior].Z,true)
  8. how would I then use getElementData to get it all out and work as intinfo and all that
  9. Would that single setElementData transfer all the other IntInfo[1]={} also? Or would I have to make one for each, also would it then transfer everything inside like IntInfo[1].X and IntInfo[1].Y in that one elementdata?
  10. What you mean by sending the table as data? Care to explain a bit cause I don't really get it.
  11. Oh well it seems like the variables wasn't even the problem lol, but yea karlis the problem with that is that I would have to like call all the datanames like int(IDhere)_nameofthething ? Else it wouldn't work cause I got a lot of interiors not just one?
  12. Hey now I'm currently working on my business system which is built together with a interior system I got, now I got this problem since the loading of the business and the interior is in two seperate files, I'm saving the interiors like in a variable similar to this: IntInfo = {} -- Later in code IntInfo[idx] = {} But then when I try and use IntInfo in my business loading lua it doesn't seem to work, it errors me like that the output from the IntInfo in that file just equals a ? Is there some other way you should do this or what is going on? If you need to see more code or anything then just ask me
  13. I'm trying to retrieve information I stored in another lua file in a whole different lua file during the server being running, Currently it does not seem to work tbh. What I'm doing is following: File1 IntInfo = {} -- At start of the script IntInfo[idx] = {} -- In the for idx = 1,max do Then I load some stuff into the IntInfo. File2 IntInfo = {} -- At start of the script IntInfo[idx] = {} --used after checking again with for idx= 1, max do --but this time it's for a binded key R used for entering interiors. --Then I do some for example: setElementPosition (source,IntInfo[idx].X,IntInfo[idx].Y,IntInfo[idx].Z,true) -- Here I do receive a error with bad argument
  14. Nah I'm all about making it myself, this way I learn everything from bottom and everything will be a lot easier in the end. Plus my project is far different then any other here I personally suspect it to be so I'm better off doing my own customized scriptings
  15. Doh forgot all about 2.5 table storing -.-
  16. I'm wondering how to go about a house system in LUA, I really hope theres a way as easy as in PAWN with enums What I'm meaning about how to on about it is how I should do for the storing while the server is running Now the server information is in MySQL tho I still need to have some "housedata[houseid][something]" in LUA to work with else it will just become a pain, so I'm wondering if anybody got a suggestion on what I could do as the best solution for such?
  17. Oh okay that explains it tbh, thanks you anyway guys.
  18. Hmm wait a sec, I must have not read it enough I mean it says: stand on, does that mean it only triggers if I stand on top of the player?
  19. I'm trying to send a TEST message when player1 touches player2 function outputElementType( prev, current ) if(current) then if getElementType(current) == "player" then outputChatBox("TEST") end end end addEventHandler ("onPlayerContact", getRootElement(),outputElementType)
  20. Well I tried ingame and that was what it did to me which I find strange now ofcourse, I suppose I just disable the controls instead or so.
  21. Yea well I've tried to set it to true, even tried to set it to true then back to false. It's just cause when the vehicle gets created the way the engine is off at that point is not really off, it's kinda on since you can drive it as soon as you enter it, if you go enter a vehicle after it's been spawned and sets the enginestate to false it will be like not able to drive at all
  22. I'm trying to setVehicleEngineState(vehicle,false) When I create a vehicle but for some reason that wont work, how come? bool setVehicleFrozen ( vehicle theVehicle, bool freezeStatus ) works when I use that. I'm running the setVehicleEngineState right after I createVehicle.
  23. Okay I think I got it now, I kinda get what you mean. I've decided to just spawn all vehicles at start for now as that seems to be the best solution right now. EDIT: Thank you hehe
  24. Again I'm not trying to spawn vehicles at start of the server load, therefore I don't think that would work. All I'm trying to do is to load basically a mysql query (multiple) and save every single one of them into each own variable so I can use the information ingame later on without having to run a query at that time.
×
×
  • Create New...