Jump to content

question about window


Chaos

Recommended Posts

Posted
  
function gui()  
triggerServerEvent ("checkforadmins", getLocalPlayer())  
end  
bindKey ("F2", "down", gui)  
  
  
  
    addEvent ( "ok", true ) 
    addEventHandler ( "ok", getRootElement(), 
        function () 
        if (guiGetVisible (okno) == false) then  
guiSetVisible(okno, true)  
showCursor(true)  
else  
guiSetVisible(okno, false)  
showCursor(false)  
end  
end 
) 
  
  

why the window will show for all players when some one press f2 i need it appear for one player only

Posted

Post the server side part too, the problem is obviously there.

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

addEvent ( "checkforadmins", true )

addEventHandler ( "checkforadmins", getRootElement(),

function ()

local accName = getAccountName ( getPlayerAccount ( source ) )

if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then

triggerClientEvent ("ok", source)

end

end

)

Posted
triggerClientEvent ("ok", source) 

Change that to:

triggerClientEvent ( source, "ok", source ) 

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

it's ok now but i have more questions why when i click on window some buttons will pressed and another question is that correct ?

triggerServerEvent ("minigun", getLocalPlayer())

Posted

Post the code.

Yes, that's correct.

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
  
GUIEditor = {  
button = {},  
window = {},  
label = {}  
}  
addEventHandler("onClientResourceStart", resourceRoot,  
function()  
okno = guiCreateWindow(553, 303, 494, 466, "Admin Panel by Chaos", false)  
guiWindowSetSizable(okno, false)  
guiWindowSetMovable(okno, false)  
guiSetVisible(okno, false)  
  
  
szeryf = guiCreateButton(181, 109, 126, 65, "Give Me Minigun", false, okno)  
guiSetProperty(szeryf, "NormalTextColour", "FFAAAAAA")  
lekarz = guiCreateButton(180, 199, 127, 68, "Full Health", false, okno)  
guiSetProperty(lekarz, "NormalTextColour", "FFAAAAAA")  
robotnik = guiCreateButton(182, 293, 125, 67, "Clear The Main Chat", false, okno)  
guiSetProperty(robotnik, "NormalTextColour", "FFAAAAAA")  
strazak = guiCreateButton(325, 109, 133, 65, "Give me infernus", false, okno)  
guiSetProperty(strazak, "NormalTextColour", "FFAAAAAA")  
mechanik = guiCreateButton(326, 201, 132, 66, "Nitro", false, okno)  
guiSetProperty(mechanik, "NormalTextColour", "FFAAAAAA")  
pilot = guiCreateButton(325, 293, 133, 67, "Fix My Vehicle", false, okno)  
guiSetProperty(pilot, "NormalTextColour", "FFAAAAAA")  
  
  
  
addEventHandler ( "onClientGUIClick", lekarz, lekarzz) 
addEventHandler ( "onClientGUIClick", strazak, strazakk) 
addEventHandler ( "onClientGUIClick", szeryf, szeryff)  
addEventHandler ( "onClientGUIClick", pilot, pilott)  
addEventHandler ( "onClientGUIClick", mechanik, mechanikk) 
addEventHandler ( "onClientGUIClick", robotnik, robotnikk) 
end  
)  
  
  
function gui()  
triggerServerEvent ("checkforadmins", getLocalPlayer())  
end  
bindKey ("F2", "down", gui)  
  
  
  
    addEvent ( "ok", true ) 
    addEventHandler ( "ok", getRootElement(), 
        function () 
        if (guiGetVisible (okno) == false) then  
guiSetVisible(okno, true)  
showCursor(true)  
else  
guiSetVisible(okno, false)  
showCursor(false)  
end  
end 
) 
  

Posted
addEventHandler ( "onClientGUIClick", lekarz, lekarzz) 
addEventHandler ( "onClientGUIClick", strazak, strazakk) 
addEventHandler ( "onClientGUIClick", szeryf, szeryff) 
addEventHandler ( "onClientGUIClick", pilot, pilott) 
addEventHandler ( "onClientGUIClick", mechanik, mechanikk) 
addEventHandler ( "onClientGUIClick", robotnik, robotnikk) 

You forgot about the "getPropagated" argument.

addEventHandler ( "onClientGUIClick", lekarz, lekarzz, false) 
addEventHandler ( "onClientGUIClick", strazak, strazakk, false) 
addEventHandler ( "onClientGUIClick", szeryf, szeryff, false) 
addEventHandler ( "onClientGUIClick", pilot, pilott, false) 
addEventHandler ( "onClientGUIClick", mechanik, mechanikk, false) 
addEventHandler ( "onClientGUIClick", robotnik, robotnikk, false) 

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

Thanks mate I want to add another button called unlimited health but the problem is when I press it all will have unlimited health

  
  
function stopMinigunDamage (  )      
        cancelEvent() --cancel the event   
  end 
 addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) 
  
  
  

Posted

Well, that's because you put the event just when script starts, is not inside a function which is triggered when click a GUI element.

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

addEventHandler ( "onClientGUIClick", unlimited,stopMinigunDamage, false)

already did that but when I press the button all wont die

Posted

Because that's wrong.

You must do something like this:

function stopDamage ( ) 
    addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) 
end 

Then:

addEventHandler ( "onClientGUIClick", unlimited, stopDamage, false ) 

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

It's on the "stopMinigunDamage" function which you should also add of course, or you can also do this:

function stopDamage ( ) 
    addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelEvent ) 
end 

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

Post the whole code.

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

My script would work perfectly fine, he obviously forgot to add something.

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

addEventHandler ( "onClientGUIClick", pilot, pilott,false)

addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelEvent )

it's just 2 only

Posted

That happens when you click it more than once, right?

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

You can do this:

removeEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelEvent ) 
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelEvent ) 

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

yh it's working if i want to add button to disable that

removeEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelEvent )

?

and why when the zombies attacking me i will die?

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