nikitafloy Posted April 24, 2014 Share Posted April 24, 2014 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
Vinctus Posted April 24, 2014 Share Posted April 24, 2014 replace isWindowOpen with isElement Link to comment
nikitafloy Posted April 24, 2014 Author Share Posted April 24, 2014 replace isWindowOpen with isElement Not an element. How can I disable Freeroam frozen for a player? Link to comment
Vinctus Posted April 24, 2014 Share Posted April 24, 2014 setElementFrozen(theguy, false) Link to comment
nikitafloy Posted April 24, 2014 Author Share Posted April 24, 2014 setElementFrozen(theguy, false) I must check this before visible GUI. Link to comment
Dealman Posted April 24, 2014 Share Posted April 24, 2014 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. Link to comment
nikitafloy Posted April 24, 2014 Author Share Posted April 24, 2014 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. 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
myonlake Posted April 24, 2014 Share Posted April 24, 2014 If that returns false, then you must make sure you use setElementFrozen when you freeze a player. It should work right now. Link to comment
nikitafloy Posted April 24, 2014 Author Share Posted April 24, 2014 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
myonlake Posted April 24, 2014 Share Posted April 24, 2014 It doesn't seem to setElementFrozen the player element. Add that in the code. Link to comment
Dealman Posted April 24, 2014 Share Posted April 24, 2014 That freezes the vehicle, not the player. isElementFrozen(getPedOccupiedVehicle(localPlayer)) Link to comment
nikitafloy Posted April 24, 2014 Author Share Posted April 24, 2014 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
myonlake Posted April 24, 2014 Share Posted April 24, 2014 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
nikitafloy Posted April 24, 2014 Author Share Posted April 24, 2014 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
myonlake Posted April 24, 2014 Share Posted April 24, 2014 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
nikitafloy Posted April 24, 2014 Author Share Posted April 24, 2014 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
myonlake Posted April 24, 2014 Share Posted April 24, 2014 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
nikitafloy Posted April 26, 2014 Author Share Posted April 26, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now