hello everyone i am working on gui for the first time and want to know that how can i solve this problem
my code
- > store/scripts/main.nut
then i added this to
then i added this to
my code
- > store/scripts/main.nut
Code Select
::fireman_wnd <- null;
::button1 <- null;
::button2 <- null;
then i added this to
Code Select
function Server::ServerData(stream)
{
local type = stream.ReadString();
local id = stream.ReadInt();
if(type == "NO_fireman")
{
::fireman_wnd = null;
::button1 = null;
::button2 = null;
}
if(type == "fireman")
{
GUI.SetMouseEnabled(true);
::fireman_wnd = GUIWindow(VectorScreen(sX / 4, sY / 4),VectorScreen(sX / 3, sY / 4),Colour(255,255,255),"You want to fireman job?")
::button1 = GUIButton(VectorScreen(50,50),VectorScreen(100,50),Colour(0,255,0),"true");
::button2 = GUIButton(VectorScreen(250,50),VectorScreen(100,50),Colour(255,0,0),"false");
::fireman_wnd.AddChild(button1);
::fireman_wnd.AddChild(button2);
}
then i added this to
Code Select
function GUI::ElementClick(element, mousex, mousey)
{
if(element == button1)
{
GUI.SetMouseEnabled(false);
local Data = Stream();
Data.WriteString("NO_fireman");
Server.SendData(Data);
}
if(element == button2)
{
GUI.SetMouseEnabled(false);
local Data = Stream();
Data.WriteString("YES_fireman");
Server.SendData(Data);
local Data = Stream();
Data.WriteString("NO_fireman");
Server.SendData(Data);
}
basically my aim was that if i do /fireman or just createcheckpoint so a box appears questioning me that do u want a fireman job with buttons yes or no so that when i click yes the skin changes else no so not ckin changed,... im new to this so kindly give some hands plz ty