Jump to content

(Duda) Haciendo un script para un logo en la pantalla


Otto

Recommended Posts

Posted (edited)

Bueno, el logo es el tipico de el DKR que aparece abajo a la derecha, y el script que tengo hasta ahora, es este:

local sw, sh = guiGetScreenSize ( ) 
local width, height = 200, 31 
guiCreateStaticImage ( sw - ( width / 2 ), sh - ( height / 2 ) , width, height, "fgislogo.png", false ) 
function checkResolutionOnStart ( theResource ) 
    if theResource ~= getThisResource() then return end 
    local x,y = guiGetScreenSize() 
    if ( x <= 640 ) and ( y <= 480 ) then 
        outputChatBox ( "Wait! You are running this game with a low resolution. Some things would not appear on your screen. Turn resolution more than 640x480 if you can." ) 
    end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), checkResolutionOnStart ) 

La imagen es esta:

dkrlogo.png

Y se va a llamar "fgislogo.png"

Bueno, ahora dos cosas:

1) ¿Esta bien el script?

2) ¿Que hago en el meta.xml para que LUA reconosca a fgislogo.png como "theElement"?

Desde ya gracias.

Edited by Guest

Ingame name: Otto

State: Inactive

Web designer. Playing MTA:SA since 2008.

Posted

Simple, no lo haces, cuando Benxamix te dio el codigo se equivoco, no es el 'image path' lo que necesitas, sino el elemento GUI del que queres extraer el tamaño.

local sw, sh = guiGetScreenSize ( ) 
local width, height = 20, 30 
guiCreateStaticImage ( sw - ( width / 2 ), sh - ( height / 2 ) , width, height, "fgislogo.png", false ) 
function checkResolutionOnStart ( theResource ) 
    if theResource ~= getThisResource() then return end 
    local x,y = guiGetScreenSize() 
    if ( x <= 640 ) and ( y <= 480 ) then 
        outputChatBox ( "Wait! You are running this game with a low resolution. Some things would not appear on your screen. Turn resolution more than 640x480 if you can." ) 
    end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), checkResolutionOnStart ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
local width, height = 20, 30 
guiCreateStaticImage ( sw - ( width / 2 ), sh - ( height / 2 ) , width, height, "fgislogo.png", false ) 

El local width, height = 20, 30 es donde va a estar en la pantalla y el ( sw - ( width / 2 ), sh - ( height / 2 ) , width, height, (etc..) el tamaño de la imagen?

Ingame name: Otto

State: Inactive

Web designer. Playing MTA:SA since 2008.

Posted

Lo hiciste todo alrevez... width, height = tamaño.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Lo hiciste todo alrevez... width, height = tamaño.

Pero no me respondes a la pregunta, a lo que me refiero es cual es cual. Si el segundo es para la imagen y si el 1 es para la posicion en la pantalla.

Ingame name: Otto

State: Inactive

Web designer. Playing MTA:SA since 2008.

Posted

Creo que ya responde a la pregunta, el width y height es el tamaño, y el otro se responde por si solo, yo diria.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Lo hiciste todo alrevez... width, height = tamaño.

Pero no me respondes a la pregunta, a lo que me refiero es cual es cual. Si el segundo es para la imagen y si el 1 es para la posicion en la pantalla.

guiCreateStaticImage ( sw - ( width / 2 ), sh - ( height / 2 ) , width, height, "fgislogo.png", false ) 

es para la imagen

local width, height = 20, 30 

es para la poseción en la pantalla entonces.

Ingame name: Otto

State: Inactive

Web designer. Playing MTA:SA since 2008.

Posted

No.

width, height = tamaño de la imagen

sw, sh = tamaño de la pantalla

El script que te di es para que tu logo quepa justo en la posicion inferior derecha de la pantalla, sin pixeles de mas o de menos.

Puedes modificar esto en los primeros 2 argumentos de guiCreateStaticPosition, usando "- valor"

ejemplo:

sw - ( width / 2 ) - 15

Para tirar el logo 15 pixeles mas a la izquierda

Posted

Algo así?

local sw, sh = guiGetScreenSize ( ) 
local width, height = 200, 31 
guiCreateStaticImage ( sw - 15 ( width / 2 ), sh - ( height / 2 ) , width, height, "fgislogo.png", false ) 
function checkResolutionOnStart ( theResource ) 
    if theResource ~= getThisResource() then return end 
    local x,y = guiGetScreenSize() 
    if ( x <= 640 ) and ( y <= 480 ) then 
        outputChatBox ( "Wait! You are running this game with a low resolution. Some things would not appear on your screen. Turn resolution more than 640x480 if you can." ) 
    end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), checkResolutionOnStart ) 

Ingame name: Otto

State: Inactive

Web designer. Playing MTA:SA since 2008.

Posted

En lugar de preguntar porque no lo pruebas? es mas rapido y mas informativo.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
En lugar de preguntar porque no lo pruebas? es mas rapido y mas informativo.

Donde pongo el script? En MTA:SA FOLDER > Server > Mods > Deathmatch > resources ?

Ingame name: Otto

State: Inactive

Web designer. Playing MTA:SA since 2008.

Posted

Gracias capo. Cuando termine esto abro un post por el meta, exitos!

Ingame name: Otto

State: Inactive

Web designer. Playing MTA:SA since 2008.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...