Jump to content

HOW DO I GIVE A CONTROL BY THE PANEL


[N]inja

Recommended Posts

Posted (edited)
i wanted to give /quit for a click on the panel but I'm not finding any way or function to do this
Edited by [N]inja
Posted

AFAIK you can't close client's game with a script. The only way is the client to do that himself (via /quit or from the game menu).

Posted (edited)

That's what I meant in the above post - YOU CAN'T.

Instead you could just kick the player from the server when the quit button is pressed.

Edited by SpecT
Posted (edited)
20 hours ago, [N]inja said:

how do I do that?

 

Do you have any code we can help you with?
We are here to help you with your scripts not write them from scratch for you.

Edited by SpecT
  • 2 months later...
Posted
--Client side
--If you want with GUI
function clickButton()
if (source == button) then
triggerServerEvent("leaveP", localPlayer)
end
end
addEventHandler("onClientGUIClick", getRootElement(), clickButton)

--If you want with DX
function clickButton2(_,state)
if isMouseInPosition(coordonates here) then
if state == "down" then
triggerServerEvent("leaveP", localPlayer)
end
end
end
addEventHandler("onClientClick", getRootElement(), clickButton2)

--Server side
function leaveP()
kickPlayer(source, "asd")
end
addEvent("leaveP", true)
addEventHandler("leaveP", root, leaveP)

 

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