Jump to content

benwilkins

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by benwilkins

  1. I have tried the code below, and it just doesn't do anything on the maverick. I do the same code on a car, and it works perfectly as it should. I am trying to increase the acceleration and/or max speed of a maverick. setVehicleHandling(maverick, "maxVelocity", 10000) setVehicleHandling(maverick, "engineAcceleration", 10000)
  2. As you can see it would be nice if I could move the debugsscript to somewhere else on the screen. Is this possible, Havent seen any settings in my client.
  3. <removeWorldObject id="removeWorldObject (gm_build4_LAn2) (1)" radius="83.26461" interior="0" model="4718" lodModel="4719" posX="1760.1641" posY="-1127.2734" posZ="43.66406" rotX="0" rotY="0" rotZ="0"></removeWorldObject> I can't seem to remove the windows after removing the building?
  4. function toggle () local screenWidth, screenHeight = guiGetScreenSize( ) local window = guiCreateWindow( 0, 0, screenWidth/1.2, screenHeight/1.2, "Mobile Data Computer", false ) exports.global:centerWindow(window) guiSetInputEnabled(not guiGetInputEnabled()) guiWindowSetSizable ( window, false ) guiSetAlpha( window, 255) local browser = guiCreateBrowser( 0, 28, screenWidth/1.2, screenHeight/1.35, false, false, false, window ) local theBrowser = guiGetBrowser( browser ) local closeButton = guiCreateButton( 0, (screenHeight/1.35)+40, screenWidth/1.2, 50, "Close Mobile Data Computer", false, window ) addEventHandler("onClientGUIClick", closeButton, function () destroyElement(window) destroyElement(browser) destroyElement(theBrowser) destroyElement(closeButton) window = nil browser = nil theBrowser = nil guiSetInputEnabled(not guiGetInputEnabled()) end) addEventHandler( "onClientBrowserCreated", theBrowser, function( ) loadBrowserURL( source, "http://facebook.com" ) end ) end addCommandHandler("callmdc", toggle ) addEventHandler("onClientResourceStart", getResourceRootElement(), function() requestBrowserDomains({"http://facebook.com"}) end ) This code works fine sometimes, when I do it, its fine, but for everyone else, it just shows the GUI window, with no browser inside. No errors in debug.
  5. How can I request info from server scripts? Inside a client function, I need to run a SQL query, which can only be done in server, and I need to send back the row of data. I have tried: -- CLIENT function getCharacterInfo(charid) triggerServerEvent("server:getCharInfo", getRootElement(), charid) end function test () details = getCharacterInfo("1") outputChatBox(details["charactername"]) end -- SERVER function servergetCharInfo ( charid ) local cmSQL = mysql:query("SELECT * FROM `characters` WHERE `id`='"..charid.."'") or false local row = mysql:fetch_assoc(cmSQL) or false return row end addEvent( "server:getCharInfo", true ) addEventHandler( "server:getCharInfo", getRootElement(), servergetCharInfo ) Doesn't seem to work..
  6. local currentTab = guiGetSelectedTab(tabPanel) local currentTabText = currentTab[guiGetText(label)] local currentTab = guiGetSelectedTab(tabPanel) local currentTabText = currentTab.guiGetText(label) local label = guiCreateLabel (0.04, 0.04, 1, 1, "Value #1", true, tab) Above is my example code.. I create multiple tabs, and each tab has exactly the same label names, just different values. How can I get the value of something in say, "Tab 1", "Label 1", but outside of the tab creation area. Further down the scripts. I know it is possible, I have done it before, I just completely forgot how. I forgot to mention, first 2 blocks of code is what I have tried, and doesn't work.
  7. I am creating blips for all vehicles. They are fine, but how would I go about adding text to the side of the blip. My plan is to have a blip, and the vehicle name in a small bordered box to the right side. I am just unsure how to get the text binded to the blip.
  8. I am having a weird problem, I have this in my .map file when the map is loaded it removes the object, but when I go out of the interior, and re enter the interior the object is back. I tried searching, couldn't find anything like this. "removeWorldObject (MED_OFFICE_CHAIR) (14)" radius="2.7432575" interior="10" dimension="426" model="1806" lodModel="0" posX="275.15625" posY="108.34375" posZ="1007.8047" rotX="0" rotY="0" rotZ="0">
  9. Wow.. Some awesome maths right there! local x, y = getElementPosition(elem) x = math.floor((x + 3000) * g_MapSide / 6000) - 4 y = math.floor((3000 - y) * g_MapSide / 6000) - 4 guiSetPosition(player.gui.mapBlip, x, y, false) Thanks alot, I forgot all about the map in freeroam, I dont use the resource
  10. I am just thinking about a new idea that I thought up. A command to pop up a gui window, and a map inside. The map image will have icon images of players locations, I dont want to use the F11 map which would be easy, because that already has a tonne of blips on or other things. I know the map will be made with: guiCreateStaticImage ( 10, 30, 500, 500, "map.jpg", false, window) I have thought of every possible situation, and I cant seem to work it out how to convert player x,y,z into static screen x,y,z for the image icon locations. I dont think it is possible. What do you guys think?
  11. I can't believe I never thought of that. Thank you
  12. How did you solve it?
  13. Thank you, after your reply, I found out that TCP and UDP port 20031 needs to be open for anyone having this error.
  14. A friend of mine is trying to connect to my server, and he constantly gets an error: Error downloading requested files. Failure when receiving data from the peer. He only gets this error on my server, but at the same time, no other player gets the error. http://puu.sh/3FwVc.jpg
  15. Hey, I have looked around the forum for a topic relating to this but I haven't come across one as of yet. Basically, I have some server side vehicle mods on the server, and a few people are asking if we can create a function to toggle the mods for them, so that they can see there own mods. We have quite a few players who really like the server mods so we don't want to remove them, we just want to make everyone happy. Is this possible with MTA at the moment? I was thinking, of a command to set a database entry or setElementData and if that is set to 0, then dont apply the mods for that user?
  16. That kind of works. When I restart the resource, he spawns with a weapon, but then after a second the weapon disappears.
  17. local result = mysql:query("SELECT id, x, y, z, dimension, interior, rotation, skin FROM peds") while true do local row = exports.mysql:fetch_assoc(result) if not (row) then break end local id = tonumber(row["id"]) local x = tonumber(row["x"]) local y = tonumber(row["y"]) local z = tonumber(row["z"]) local dimension = tonumber(row["dimension"]) local interior = tonumber(row["interior"]) local rotation = tonumber(row["rotation"]) local skin = tonumber(row["skin"]) local ped = createPed(skin, x, y, z) setPedRotation(ped, rotation) setElementDimension(ped, dimension) setElementInterior(ped, interior) if(id BETWEEN 120 AND 180) then giveWeapon( ped, 31, 1, true ) end Thats why I have tried so far
  18. Hey, I have some code to generate the peds from the database. Everytime i create a ped, it makes a unique field to the ped called "id". When I get the results from the database to make the peds in game, I need a way to do like. (if "id" is between 120 and 180, then set those peds to have an M4) but not the other peds.
  19. Is there anyway to determine where the x,y,z is of a cars roof? I am trying to display a small text box above the roof, but say for instance its a bike, the text box is higher, if its a big truck, the text box is below the roof.
  20. I tried that, but it just makes them huge when you walk away http://puu.sh/3fHz4.jpg
  21. Hey, basically, I want to display the license plate above cars, as I have right now, it isnt above the car at all times. If I drive a little away from a car, the text goes way up high. I am wondering how I can scale it, so that the position is always locked right above the cars roof at whatever distance you are away from the car, and the further away from the car, the smaller it is? Thanks, much appreciated This is what I have so far. local px, py, pz = getElementPosition(localPlayer) -- vehicles for key, value in ipairs(getElementsByType("vehicle")) do if isElementStreamedIn(value) and (isElementOnScreen(value)) then local x, y, z = getElementPosition(value) local plateText = getVehiclePlateText ( value ) if (isLineOfSightClear(px, py, pz, x, y, z, true, false, false, true, false, false, true)) then local tx, ty = getScreenFromWorldPosition(x, y, z, 5000, false) if (tx) then local size = dxGetTextWidth(getVehicleName(value), 1, "bankgothic") + 170 dxDrawText(plateText, tx, ty, tx, ty-200, tocolor(10, 255, 10, 160), 0.6, "bankgothic", "center", "center") end end end end
  22. Also, there is no errors in the debug
×
×
  • Create New...