Jump to content

MySQL help


StefanAlmighty

Recommended Posts

  • Moderators
mysql_ functions need the mysql module to work

We already solved that part of the topic MIKI785. You are kinda late ...

@StefanAlmighty: You asked to help you to find your "SDK user and pass" but there is no such things in MTA.

So try to investigate where is this error coming from. Maybe from a resource or a plugin idk.

By the way where did you see this this ? in the server console ? in the chatbox ? somewhere else ?

Link to comment

Ah I was just wondering, it doesn't matter about SDK I guess.

I'm trying to create a GUI, I've created this code but it doesn't work? It only shows the cursor, the actual GUI doesn't show.

  
function buildTeleportGUI() 
    local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 384, 210 
    local left = screenWidth/2 - windowWidth/2                       -- grabs the center of the screen 
    local top = screenHeight/2 - windowHeight/2 
    mainTeleportWindow = guiCreateWindow(left, top, windowWidth, windowHeight, "Admin Teleporter © Almighty", true) 
    closeTeleportWindowBtn = guiCreateButton(left, top, windowWidth, windowHeight, "Close", true, mainTeleportWindow) 
    guiSetVisible(mainTeleportWindow, false) 
end 
  
function openTeleportGUI(playerSource) 
    guiSetVisible(mainTeleportWindow, true) 
    showCursor(true) 
end 
addCommandHandler("gotoplace", openTeleportGUI, false, false) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(),  
    function () 
        buildTeleportGUI() 
    end 
) 

Link to comment
  • Moderators

Please make a new topic when you have a new problem as it has nothing to do with a MySQL problem anymore.

I'll answer anyway:

You are using pixels to define the position and the size of your gui components so an absolute position and size but you are explicitly saying that they are relative instead by setting true for the relative argument.

relative: This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing sizes/positions as a fraction of the screen size. If false, then the size and co-ordinates are based on client's resolution

So if (for example) you set 300 for the left argument and you say it's a relative position then the gui component will be placed on the right for about 300 times the width of the player's screen resolution.

Imagine if the player has a 1920x1080 screen resolution, if we keep our example, then the gui component will be placed at 1920*300 = 576000 pixels on the right so it's totally out of the screen as you can guess :D

Fixed code:

mainTeleportWindow = guiCreateWindow(left, top, windowWidth, windowHeight, "Admin Teleporter © Almighty", false) 
closeTeleportWindowBtn = guiCreateButton(left, top, windowWidth, windowHeight, "Close", false, mainTeleportWindow) 

Note that you don't want to use the same values for the button as its final position will be calculated from within its parent which is your window and not from within the player's total screen like your window which has no parent.

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