Jump to content

Cant hide GUI freeroam


nikitafloy

Recommended Posts

    function toggleFRWindow() 
    local currentFreezeStatus = isElementFrozen ( localPlayer ) -- false only 
    if not skinsA[getElementModel(localPlayer)] then 
        if not currentFreezeStatus then 
            if isWindowOpen(wndMain) then 
                showCursor(false) 
                hideAllWindows() 
                colorPicker.closeSelect() 
            else 
                showCursor(true) 
                showAllWindows() 
            end 
        end 
    end 
    end 
      
    addCommandHandler('fr', toggleFRWindow) 
      

Link to comment
A GUI Window is an element.

Either way, you can use guiGetVisible to check whether it is visible or not. If this is not what you're looking for, I remain greatly confused as to what you're trying to do. :P

    local currentFreezeStatus = isElementFrozen ( localPlayer ) -- false only 

If a person is frozen, it returns false. I understand that is not an element localPlayer. Then how can I disable a person to use frozen F1? thx.

Link to comment
If that returns false, then you must make sure you use setElementFrozen when you freeze a player. It should work right now.

Use from admin.

addEvent ( "onPlayerFreeze", false ) 
function aSetPlayerFrozen ( player, state ) 
    if ( toggleAllControls ( player, not state, true, false ) ) then 
        aPlayers[player]["freeze"] = state 
        triggerEvent ( "onPlayerFreeze", player, state ) 
        local vehicle = getPedOccupiedVehicle( player ) 
        if vehicle then 
            setElementFrozen ( vehicle, state ) 
        end 
        return true 
    end 
    return false 
end 
  

Link to comment
It doesn't seem to setElementFrozen the player element. Add that in the code.

user and vehicle together

        elseif ( action == "freeze" )  then 
            if ( isPlayerFrozen ( player ) ) then action = "un"..action end 
            aSetPlayerFrozen ( player, not isPlayerFrozen ( player ) ) 
  

Link to comment

It doesn't make any sense, because the script never executes setElementFrozen on the player element - only on a possible vehicle element, which is very awkward. It does use isElementFrozen though, but yeah, that's not much use when it doesn't even use the native functionality.

Link to comment
It doesn't make any sense, because the script never executes setElementFrozen on the player element - only on a possible vehicle element, which is very awkward. It does use isElementFrozen though, but yeah, that's not much use when it doesn't even use the native functionality.

what can i do?

How can I hide for frozen F1 player?

Link to comment

Replace that old aSetPlayerFrozen with this one.

function aSetPlayerFrozen( player, state ) 
    if ( toggleAllControls( player, not state, true, false ) ) then 
        aPlayers[ player ][ "freeze" ] = state 
        setElementFrozen( player, state ) 
        local vehicle = getPedOccupiedVehicle( player ) 
        if ( vehicle ) then 
            setElementFrozen( vehicle, state ) 
        end 
        triggerEvent( "onPlayerFreeze", player, state ) 
        return true 
    end 
    return false 
end 

Link to comment
Replace that old aSetPlayerFrozen with this one.
function aSetPlayerFrozen( player, state ) 
    if ( toggleAllControls( player, not state, true, false ) ) then 
        aPlayers[ player ][ "freeze" ] = state 
        setElementFrozen( player, state ) 
        local vehicle = getPedOccupiedVehicle( player ) 
        if ( vehicle ) then 
            setElementFrozen( vehicle, state ) 
        end 
        triggerEvent( "onPlayerFreeze", player, state ) 
        return true 
    end 
    return false 
end 

Thanks, I used what you wrote in the first post.

How i can ban cmd for frozen user?

    addEventHandler("onPlayerCommand", resourceRoot, 
    function(cmd) 
        local accPlayer = getAccountPlayer ( source ) 
         if tonumber(getAccountData ( accPlayer, "jail-time" )) > 0 or isElementFrozen( source ) then 
              cancelEvent() 
         end 
    end) 

Freeze with:

                setElementFrozen ( source, true ) 
  

Link to comment

Try the following. If it does not work, then switch resourceRoot to root.

addEventHandler( "onPlayerCommand", resourceRoot, 
    function( cmd ) 
        local playerAccount = getPlayerAccount( source ) 
        local shouldCancel = ( playerAccount and not isGuestAccount( playerAccount ) and getAccountData( playerAccount, "jail-time" ) ) and tonumber( getAccountData( playerAccount, "jail-time" ) ) > 0 or isElementFrozen( source ) 
        if ( shouldCancel ) then cancelEvent( ) end 
    end 
) 

Link to comment
Try the following. If it does not work, then switch resourceRoot to root.
addEventHandler( "onPlayerCommand", resourceRoot, 
    function( cmd ) 
        local playerAccount = getPlayerAccount( source ) 
        local shouldCancel = ( playerAccount and not isGuestAccount( playerAccount ) and getAccountData( playerAccount, "jail-time" ) ) and tonumber( getAccountData( playerAccount, "jail-time" ) ) > 0 or isElementFrozen( source ) 
        if ( shouldCancel ) then cancelEvent( ) end 
    end 
) 

dont work :(

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