iFoReX Posted February 3, 2013 Share Posted February 3, 2013 porque a algunos se les ve corrido si uso screen size ?? function complementos() local sWidth,sHeight = guiGetScreenSize() local players = getElementsByType("player") dxDrawText("#00ffffBienvenidos a", sWidth*0.150, sHeight*0.920, 635, 274, tocolor(255, 255, 255, 255), .6, "bankgothic", "left", "top", false, false, true, true, true) dxDrawText("#ff6600TwD|Dead City Infection -Zombies- Resident Evil Latino [Zombies] 24/7", sWidth*0.150, sHeight*0.940, 635, 274, tocolor(255, 255, 255, 255), .6, "bankgothic", "left", "top", false, false, true, true, true) dxDrawText("#00ffffPlayers Online : #ff6600"..tostring(#players).."#00ffff/#ff6600150", sWidth*0.600, sHeight*0.920, 635, 274, tocolor(255, 255, 255, 255), .6, "bankgothic", "left", "top", false, false, true, true, true) end Link to comment
Alexs Posted February 3, 2013 Share Posted February 3, 2013 Por que solo lo usas en la posición, pero no en el tamaño. Link to comment
iFoReX Posted February 3, 2013 Author Share Posted February 3, 2013 Gracias alexs, ahora tengo otro problema, la gui spawn aparece corrida con otra resolucion :/ local selectedRow = -1; local selectedGroup = -1; previousClass = -1; local weaponIcons = { }; local weaponLabels = { }; local weaponAmmoLabels = { }; function createGroupSelectionWnd( ) local selectionPos = { gridList:Position( false ) }; groupsGridList = GridList:Create( screenSize[ 1 ] - gridList:Size( false ) - 260, screenSize[ 2 ] - 600, 145, 130, false ); groupsGridList: Alpha( .8 ); groupsGridList: AddColumn( "Categoria", .8 ); groupsGridList: SortingEnabled( false ); for _, group in ipairs( classGroups ) do groupsGridList:AddRow( false, group.name ); end groupsGridList:AddOnClick( groupSelected ); groupsGridList:Visible( false ); end function groupSelected( ) weaponsGrid:Visible( false ); selectedGroup = groupsGridList:SelectedItem( ); if selectedGroup ~= -1 then populateClassesGrid( classGroups[ selectedGroup + 1 ].classes ); else gridList:Clear( ); end previousClass = -1; end function createClassSelectionWnd( ) gridList = GridList:Create( screenSize[ 1 ] - 310, screenSize[ 2 ] - screenSize[ 2 ] / 1.28, 190, screenSize[ 2 ] / 2.5 - 1, false ); gridList:AddColumn( "Clase:", .85 ); gridList:Alpha( .8 ); gridList:SortingEnabled( false ); gridList:AddOnClick( classSelected ); gridList:Visible( false ); local gridSize = { gridList:Size( false ) }; spawnBtn = Button:Create( screenSize[ 1 ] - gridList:Size( false ) - 260, screenSize[ 2 ] - 470, 135, 30, "NACER", false ); spawnBtn:Font( "default-bold-small" ); spawnBtn:ColorOnHover( "FF5500FF" ); spawnBtn:AddOnClick( requestSpawn ); spawnBtn:Visible( false ); end function populateClassesGrid( classes ) gridList:Clear( ); for classIndex, class in pairs( classes ) do gridList:AddRow( true, class.name ); for skinIndex, skin in ipairs( class.skinMngr:GetSkins( ) ) do local row = gridList:AddRow( false, skin.name ); gridList:ItemData( row, 1, tostring( classIndex ) .."," .. tostring( skinIndex ) ); end end end function createPasswordWnd( ) passwordWnd = Window:Create( screenSize[ 1 ] / 2 - 200, screenSize[ 2 ] / 2 - 30, 400, 80, "" ); passwordWnd:AddLabel( 20, 35, "Contraseña:" ); passTextBox = passwordWnd:AddTextBox( 80, 33, 150, 20, "" ); passTextBox:Masked( true ); passSpawnBtn = passwordWnd:AddButton( 315, 31, 70, 25, "Aceptar" ); passSpawnBtn:AddOnClick( requestSpawn ); passCancelBtn = passwordWnd:AddButton( 235, 31, 70, 25, "Cancelar" ); passCancelBtn:AddOnClick( function() passwordWnd:Visible( false ); fadeCamera( true ); showSpawnMenu( true, false ); end ); passwordWnd:Movable( false ); passwordWnd:Sizable( false ); passwordWnd:Visible( false ); end function classSelected ( ) selectedRow = gridList:SelectedItem( ); if selectedRow ~= -1 then local data = split( gridList:ItemData( selectedRow, 1 ), string.byte(',') ); local classIndex = tonumber( data[ 1 ] ); local skinIndex = tonumber( data[ 2 ] ); local class = classGroups[ selectedGroup + 1 ].classes[ classIndex ]; local skin = classGroups[ selectedGroup + 1 ].classes[ classIndex ].skinMngr.skins[ skinIndex ]; enableSpawn( false ); if previousClass ~= classIndex then resizeWeaponsWnd( class.weaponMngr ); fadeCamera( false ); --setTimer( fadeCamera, 1000, 1 ); setTimer( moveCameraTo, 1000, 1, class, skin ); else teleportTempPed( skin ); end previousClass = classIndex; local classDescr = class.info; if classDescr then descrLabel:Text( classDescr ); descrGridList:Visible( true ); else descrGridList:Visible( false ); weaponsGrid:Visible( false ); end else descrGridList:Visible( false ); weaponsGrid:Visible( false ); end end function requestSpawn( pass ) selectedRow = gridList:SelectedItem(); if ( selectedGroup ~= -1 ) and ( selectedRow ~= -1 ) then local data = split( gridList:ItemData( selectedRow, 1 ), string.byte(',') ); local classIndex = tonumber( data[ 1 ] ); local skinIndex = tonumber( data[ 2 ] ); local class = classGroups[ selectedGroup + 1 ].classes[ classIndex ]; local skin = classGroups[ selectedGroup + 1 ].classes[ classIndex ].skinMngr.skins[ skinIndex ]; fadeCamera( false ); if pass == spawnBtn then setTimer( triggerServerEvent, 1000, 1, "spawn_clientRequestSpawn", g_root, selectedGroup + 1, classIndex, skinIndex ); return; end setTimer( triggerServerEvent, 1000, 1, "spawn_clientRequestSpawn", g_root, selectedGroup + 1, classIndex, skinIndex, passTextBox:Text( ) ); end end function moveCameraTo( class, skin ) local camX, camY, camZ = class.cameraMngr.pos.x, class.cameraMngr.pos.y, class.cameraMngr.pos.z; local lookAtX, lookAtY, lookAtZ = class.cameraMngr.lookAt.x, class.cameraMngr.lookAt.y, class.cameraMngr.lookAt.z; fadeCamera( true ); --outputDebugString( "fading camera in" ); setCameraMatrix( camX, camY, camZ, lookAtX, lookAtY, lookAtZ ); setTimer( teleportTempPed, 500, 1, skin ); end local losTests = 0; -- line of sight function teleportTempPed( skin ) local x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 250, ( screenSize[ 2 ] / 1.6 ) * .8, 10 ) local cX, cY, cZ; cX, cY, cZ = getCameraMatrix(); if not tempPed then createTempPed( skin.modelId ); else setElementPosition( g_ground, x, y, z - 1.02 ); setElementPosition( tempPed, x, y, z ); setElementModel( tempPed, skin.modelId ); x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 250, ( screenSize[ 2 ] / 1.6 ) * .8, 11 ) end if not processLineOfSight( cX, cY, cZ, x, y, z ) then losTests = losTests + 1; if losTests < 3 then setTimer( teleportTempPed, 300, 1, skin ); return else destroyElement( g_ground ); destroyElement( tempPed ); tempPed = nil; createTempPed( skin.modelId ); enableSpawn( true ); losTests = 0; end else enableSpawn( true ); end end function createClassDescriptionWnd( ) descrGridList = GridList:Create( screenSize[ 1 ] - 305, 5, 300, 125, false ); descrTitleLbl = Label:Create( 8, 5, 100, 30, "Informacion:", false, descrGridList.gui ); descrTitleLbl:Font( "default-bold-small" ); descrTitleLbl:Color( 255, 150, 0 ); descrLabel = Memo:Create( 10, 25, 280, 90, "", false, descrGridList.gui ); descrLabel:ReadOnly( true ); descrGridList:Alpha( 0.8 ); descrGridList:Visible( true ); end function createClassWeaponWnd( ) local descrSize = { descrGridList:Size( false ) }; weaponsGrid = GridList:Create( screenSize[ 1 ] - 120, descrSize[ 2 ] + 4, 115, 40, false ); weaponsGrid:Alpha( .8 ); weaponsGrid:Visible( false ); end function enableSpawn( enable ) bringSpawnMenuToFront( ); gridList:Enabled( enable ); spawnBtn:Enabled( enable ); if enable == true then local data = split( gridList:ItemData( selectedRow, 1 ), string.byte(',') ); local classIndex = tonumber( data[ 1 ] ); local skinIndex = tonumber( data[ 2 ] ); local class = classGroups[ selectedGroup + 1 ].classes[ classIndex ]; if class.weaponMngr:WeaponCount( ) > 0 then weaponsGrid:Visible( enable ); else weaponsGrid:Visible( false ); end end end function resizeWeaponsWnd( weaponManager ) local minHeight = 18; local weapCount = weaponManager:WeaponCount( ); local weapons = weaponManager:GetWeapons( ); weaponsGrid:Size( 115, minHeight + ( weapCount * 40 ), false ); if weapCount > 0 then for i, icon in pairs( weaponIcons ) do if icon and icon.gui then destroyElement( icon.gui ); end end weaponIcons = nil; weaponIcons = { }; for i, lbl in pairs( weaponLabels ) do if lbl and lbl.gui then Link to comment
Alexs Posted February 3, 2013 Share Posted February 3, 2013 Por que no es para que funcione igual en distintas resoluciones, en algunas (mas pequeñas) aparecerá mas a la izquierda. Link to comment
iFoReX Posted February 3, 2013 Author Share Posted February 3, 2013 ams y podria usar aqui el guiGetScreenSize ? Link to comment
Alexs Posted February 3, 2013 Share Posted February 3, 2013 Si, pero no específicamente en estas partes. Link to comment
iFoReX Posted February 3, 2013 Author Share Posted February 3, 2013 ams entonces en que partes ? Link to comment
Alexs Posted February 3, 2013 Share Posted February 3, 2013 Por lo que veo hay funciones que no publicaste, se te hace mas fácil volver a hacer uno tu. Link to comment
Recommended Posts