Jump to content

[Ayuda] GUI - Spawn 50P


NIKO_19997

Recommended Posts

hola, tengo una duda....modifique la GUI del spawn de 50P con el recurso "guieditor", pero eh intentado editar el c_gui del script y no puedo :/

aparte de modificarlo, le agrege una ventana, algun consejo o algo para poder modificarlo?

Saludos!

¿Cuál es el problema? Te da algún error o algo?

Link to comment
si mostraras lo que has echo seria mas facil ayudarte ya que nadie es adivino

sorry xDD, aqui esta:

c_gui:

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 ) - 1053,
        screenSize[ 2 ] - 231,
        279, 182,
        false );
    groupsGridList: Alpha( .80 );
    groupsGridList: AddColumn( "Categoria", .9 );
    groupsGridList: SortingEnabled( false );
    for _, group in ipairs( classGroups ) do
        groupsGridList:AddRow( false, group.name );
    end
    groupsGridList:AddOnClick( groupSelected );
    groupsGridList:Visible( false );
end
 
function groupSelected( )
    descrGridList:Visible( false );
    weaponsGrid:Visible( false );
    selectedGroup = groupsGridList:SelectedItem( );
    playSound("click.wav")
    if selectedGroup ~= -1 then
        populateClassesGrid( classGroups[ selectedGroup + 1 ].classes );
    else
        gridList:Clear( );
    end
    previousClass = -1;
end
 
 
 
function createClassSelectionWnd( )
    gridList = GridList:Create(
        screenSize[ 1 ] - 185,
        screenSize[ 2 ] - screenSize[ 2 ] / 3,
        180, screenSize[ 2 ] / 3 - 5,
        false );
    gridList:AddColumn( "Class:", .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 ) - 1073,
        screenSize[ 1 ] - 665,
        236, 53,
        "SPAWN", 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, "Password:" );
    passTextBox = passwordWnd:AddTextBox( 80, 33, 150, 20, "" );
        passTextBox:Masked( true );
    passSpawnBtn = passwordWnd:AddButton( 315, 31, 70, 25, "Spawn" );
        passSpawnBtn:AddOnClick( requestSpawn );
    passCancelBtn = passwordWnd:AddButton( 235, 31, 70, 25, "Cancel" );
        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
        playSound("click.wav")
        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 );
            playSound("click.wav")
        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 - 70, ( 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 - 70, ( 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( false );
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 );
    descrGridList:Visible( 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 =
Link to comment
  • Recently Browsing   0 members

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