Jump to content

harryh

Members
  • Posts

    108
  • Joined

  • Last visited

Everything posted by harryh

  1. I mean without needing to put a file path like. like its I type fileExists(/mods/*) will it return file names for all in directory
  2. Would it be possible for me to check what files are in a folder and save them in a table For example: local files = {} fileCheck("/mods") returns all files in folder tableinsert(files, server.lua) tableinsert(files,client.lua) tableinsert(files,text.dff) tableinsert(files,meta.xml) tableinsert(files,color.txd)
  3. Everytime I load map editor it loads me into dimension 200. Even on server restart and creating new map. If I set it back with admin panel when I add object it then sets me back to dimension 200 so it is impossible to map.
  4. function loadGUI() Adder.Window = guiCreateWindow(lx*500, ly*500, 404, 250, "Object Adder", false) Adder.Button = guiCreateButton(0.62, 0.26, 0.33, 0.66, "ADD OBJECT", true, Adder.Window) addEventHandler( "onClientGUIClick", Adder.Button, sendData) end addEventHandler( "onClientResourceStart", getRootElement( ), loadGUI ) If I click on the gui window Adder.Window it executes sendData() when it should on execute if click on button
  5. So in the shader I program the gui?
  6. Anything about grid lists ?
  7. How can I make a shader or do I have to download one?
  8. So I have been thinking about drawing a 3D GUI. However, I am unsure what functions to use as there are only 3D functions there are: DxDrawLine3D DxDrawMaterialLine3D DxDrawMaterialSectionLine3D Would I have to draw lots of 3D lines one after the other to create a 3D rectangle and How would you get people clicking on the GUI etc.
  9. Thanks @NeXuS™ made a c0ckup had oz instead of ox. local object = createObject( mid, oz, oy, oz, rox, roy, roz, false)
  10. Right Thank you very much so it is spawning but It is not visible I have used getelementmodel to check to see if the object is being created and it is but just cannot see it any idea why i have tried using setelementinterior 0 and setelementdimension 0 function loadObjects() local nrQuery = dbQuery(sqlConnection, "SELECT * FROM landobjects") local rQuery = dbPoll( nrQuery, -1 ) if (rQuery) then if (loaded == 0) then for _, row in ipairs(rQuery) do print(row["ox"]) if (not row) then outputChatBox( "no row", getRootElement()) break end local mid = row["mid"] if (not mid) then outputChatBox( "No model ID", getRootElement( )) break end local ox = row["ox"] local rox = row["rox"] local oy = row["oy"] local roy = row["roy"] local oz = row["oz"] local roz = row["roz"] local object = createObject( mid, oz, oy, oz, rox, roy, roz, false) setElementDimension( object, 0 ) setElementInterior( object, 0) print(getElementModel( object )) if (row["ds"] == 1) then setElementDoubleSided( object, true ) else setElementDoubleSided( object, false ) end table.insert(LCobs, object) triggerClientEvent( "objectStream", getRootElement( ), object, mid ) loaded = 1 end else clearLoadedObjects() loadObjects() loaded = 0 outputChatBox( "Objects Reloaded" ) end else outputChatBox( "No Objects to Load") loaded = 0 end end addCommandHandler( "loadall", loadObjects )
  11. Returns 1 so it is checking so why is rQuery return false then?
  12. What do you mean up, if you mean is the data loaded onto phpmyadmin then yes. I use MYSQL workshop to access the server db as easier than phpmyadmin
  13. Still returning rQuery as false there going to outputchatbox("No Objects to load"). The connection is working because I can use it to insert data. local hostname = "127.0.0.1" local username ="root" local password = "" local database = "testserver" local sqlConnection = dbConnect( "mysql", "dbname=".. database ..";host="..hostname.."", ""..username.."",""..password.."" ) function loadObjects() local nrQuery = dbQuery(sqlConnection, "SELECT * FROM landobjects") local rQuery = dbPoll( nrQuery, -1 ) if (rQuery) then if (loaded == 0) then for _, row in ipairs(rQuery) do if (not row) then break end local mid = row["mid"] if (not mid) then outputChatBox( "No model ID", getRootElement( )) break end local ox = row["ox"] local rox = row["rox"] local oy = row["oy"] local roy = row["roy"] local oz = row["oz"] local roz = row["roz"] local object = createObject( mid, oz, oy, oz, rox, roy, roz) local ds = function() if (row["ds"] == 1) then setElementDoubleSided( object, true ) else setElementDoubleSided( object, false ) end end table.insert(LCobs, object) triggerClientEvent( "objectStream", client, object, mid ) loaded = 1 end else clearLoadedObjects() loadObjects() loaded = 0 outputChatBox( "Objects Reloaded" ) end end outputChatBox( "No Objects to Load") end addCommandHandler( "loadall", loadObjects ) Here is the DB
  14. connection = mysql_connect(blah blah blah) query = mysql_query(connection,"SELECT * FROM landobjects") if query then for query, row in mysql_rows_assoc(query) do model = row["mid"] end end If I am correct is this suppose to select all the row. Then in each row get column mid and return it as variable model. How come this does not either error nil value or Boolean when there is information in the database. i have wrote this on phone so sorry for any mistakes
  15. Right so I have objects loaded into the server database. Like below: id mid x y z rox roy roz ds I want to check the table and go through it adding all the objects inside. row one createobject(mid,x,y,z,rox,roy,roz,ds) row two createobject(mid,x,y,z,rox,roy,roz,ds) etc untill no rows left. I have this but it is not working and returning attempt to call nil value even though there are row in the table: function loadObjects() local result = mysql:query("SELECT * FROM landobjects") if (result) then if (loaded == 0) then for result,row in mysql:rows_assoc(result) do if (not row) then break end local mid = row["mid"] local ox = row["ox"] local rox = row["rox"] local oy = row["oy"] local roy = row["roy"] local oz = row["oz"] local roz = row["roz"] local object = createObject( mid, oz, oy, oz, rox, roy, roz) local ds = function() if (row["ds"] == 1) then setElementDoubleSided( object, true ) else setElementDoubleSided( object, false ) end end table.insert(LCobs, object) triggerClientEvent( "objectStream", client, object, mid ) end loaded = 1 else clearLoadedObjects() loadObjects() loaded = 0 outputChatBox( "Objects Reloaded" ) end end outputChatBox( "No Objects to Load") end addCommandHandler( "loadall", loadObjects )
  16. no error just no water they are shared so it doesn't matter are in both
  17. I wrote this script to create water but I get no errors and nothing happens. local aw1 = {} local aw2 = {} local aw3 = {} local aw4 = {} function createAllWater() --x, y, z theWater = createWater(609, 151, -100, 609, -606, -100, 1527, 129, 4, 1527, -533, 4) setWaterLevel(theWater, 1) if theWater then print("Water is work") print(theWater) end end addEventHandler( "onClientResourceStart", getRootElement(), createAllWater ) function helpwater() outputChatBox( "aw1 = bottom left" ) outputChatBox( "aw2 = bottom right" ) outputChatBox( "aw3 = top right" ) outputChatBox( "aw4 = top left" ) end addCommandHandler("helpmew", helpwater) function addwater1(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw1, x) table.insert(aw1, y) table.insert(aw1, z) outputChatBox( "Position 1 set" ) end addCommandHandler( "aw1", addwater1) function addwater2(player, cmd) if aw1[1] == nil then outputChatBox( "Use in order please. /aw1 /aw2 /aw3 [/aw4] optional." ) else local x, y, z = getElementPosition( player ) table.insert(aw2, x) table.insert(aw2, y) table.insert(aw2, z) outputChatBox( "Position 2 set" ) end end addCommandHandler( "aw2", addwater2) function addwater3(player, cmd) if aw2[1] == nil then print("/aw1 /aw2 /aw3 /aw4") else local x, y, z = getElementPosition( player ) table.insert(aw3, x) table.insert(aw3, y) table.insert(aw3, z) print(x) print(y) print(z) outputChatBox( "Position 3 set" ) end end addCommandHandler( "aw3", addwater3) function addwater4(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw4, x) table.insert(aw4, y) table.insert(aw4, z) outputChatBox( "Position 4 set" ) end addCommandHandler( "aw4", addwater4) function completeWater(player, cmd) if aw1[1] == nil then outputChatBox("Need to do first 3. /aw1 /aw2 /aw3 ") aw1 = {} aw2 = {} aw3 = {} aw4 = {} elseif aw4[1] == nil then outputChatBox("Triangle Maded.") createWater( aw1[1], aw1[2], aw1[3], aw2[1], aw2[2], aw2[3], aw3[1], aw3[2], aw3[3]) aw1 = {} aw2 = {} aw3 = {} aw4 = {} else Awater = createWater( 0,0,0,0,0,0,0,0,0,0,0,0) setWaterVertexPosition( water, 1, aw1[1], aw1[2], aw1[3] ) setWaterVertexPosition( water, 2, aw2[1], aw2[2], aw2[3] ) setWaterVertexPosition( water, 3, aw3[1], aw3[2], aw3[3] ) setWaterVertexPosition( water, 4, aw4[1], aw4[2], aw4[3] ) outputChatBox("Square Maded.") aw1 = {} aw2 = {} aw3 = {} aw4 = {} end end addCommandHandler("awc", completeWater)
  18. Yes, Thank you, how can I move it over more to the right becauseI have DogCreate.Window = guiCreateWindow(x/2-0/2, y/2-284/2, 248, 284, "", false) and I cannot set the position code any lower than 0?
  19. Hi, thank you very much the GUI looks all correct now. What will I have to tweak to move it over to the right, I have tried editing position codes but i get to 0 and its still not over right far enough. DogCreate.Window = guiCreateWindow(x/2-0/2, y/2-284/2, 248, 284, "", false) Also how come you you have x/2-248/2 Also I understand how you mean is that I divide my screen with his screen so lets say x, y = guiGetScreenSize() His screen == 1280x720 fx, fy = 1920, 1080 lx, ly = 1280/1920, 1080/720 then you do lx * position code, ly*positioncode, width of window, height of window so guiCreateWindow(lx*poscode, ly*poscode, width of window, height of window) Is that understanding correct?
  20. Hi, I have set the code like yours but now the is hanging half off the screen on the left when it should be in top right corner. DogCreate.Window = guiCreateWindow(x/2-1517/2, y/2-119/2, 326, 270, "", false) How can I send you the font file.
  21. I have edited some stuff as said on the wiki to make GUI work on all resolution and it doesn't work still.. https://wiki.multitheftauto.com/wiki/GuiGetScreenSize The GUI looks better but is still very disfigured. local x,y = guiGetScreenSize() local xx = 1960 local yy = 1080 DogCreate.Window = guiCreateWindow(1517/1960*x, 119/1080*y, 326/1960*x, 270/1080*y, "", false) guiWindowSetMovable(DogCreate.Window, false) guiWindowSetSizable(DogCreate.Window, false) DogCreate.NameBox = guiCreateEdit(91/xx*x, 62/yy*y, 205/xx*x, 32/yy*y, "", false, DogCreate.Window) DogCreate.BreedBox = guiCreateComboBox(91/xx*x, 105/yy*y, 212/xx*x, 144/yy*y, "", false, DogCreate.Window) guiComboBoxAddItem(DogCreate.BreedBox, "German Sheperd") guiComboBoxAddItem(DogCreate.BreedBox, "Rottweiler") guiComboBoxAddItem(DogCreate.BreedBox, "Golden Retriever") guiComboBoxAddItem(DogCreate.BreedBox, "Pitbull") DogCreate.MaleRadio = guiCreateRadioButton(130/xx*x, 184/yy*y, 13/xx*x, 14/yy*y, "", false, DogCreate.Window) DogCreate.FemaleRadio = guiCreateRadioButton(192/xx*x, 181/yy*y, 13/xx*x, 14/yy*y, "", false, DogCreate.Window) DogCreate.BuyButton = guiCreateButton(23/xx*x, 205/yy*y, 280/xx*x, 54/yy*y, "Purchase Dog", false, DogCreate.Window) DogCreate.NameLab = guiCreateLabel(9/xx*x, 64/yy*y, 76/xx*x, 36/yy*y, "NAME:", false, DogCreate.Window) DogCreate.BreedLab = guiCreateLabel(8/xx*x, 106/yy*y, 77/xx*x, 24/yy*y, "BREED:", false, DogCreate.Window) DogCreate.MaLab = guiCreateLabel(130/xx*x, 165/yy*y, 16/xx*x, 16/yy*y, " M", false, DogCreate.Window) DogCreate.FeLab = guiCreateLabel(196/xx*x, 165/yy*y, 16/xx*x, 16/yy*y, " F", false, DogCreate.Window) DogCreate.WindowLab = guiCreateLabel(79/xx*x, 14/yy*y, 184/xx*x, 40/yy*y, "Dog Creator", false, DogCreate.Window) DogCreate.DogColorCombo = guiCreateComboBox(91/xx*x, 135/yy*y, 212/xx*x, 94/yy*y, "", false, DogCreate.Window) DogCreate.ColorLab = guiCreateLabel(8/xx*x, 131/yy*y, 77/xx*x, 25/yy*y, "Colour:", false, DogCreate.Window) local font0_intNameFont = guiCreateFont(":dogsystem/font.ttf", 20) guiSetFont(DogCreate.BuyButton, font0_intNameFont) Also is it possible to set the font size relative to the screen size?
×
×
  • Create New...