Jump to content

GUI Welcome Screen


CapY

Recommended Posts

Posted

Hey !

I have a little problem with welcome screen window....

It's dont want to start when player joins.

CheckBox don't Work and Accept button doesn't works.

  
-- Created: 02/07/2011 09:45 
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        guiEditor_Memo = {} 
        guiEditor_Label = {} 
        guiEditor_Image = {} 
  
        guiFgWelcomeWindow = guiCreateWindow(77,262,1279,1023," R   U   L   E   S   ! ",false) 
        guiSetAlpha(GUIFgWelcomeWindow,1) 
        guiWindowSetSizable(GUIFgWelcomeWindow,false) 
        guiFgOkButton = guiCreateButton(564,943,172,59,"O  K  ! ",false,GUIFgWelcomeWindow) 
        guiSetAlpha(GUIFgOkButton,1) 
        guiSetFont(GUIFgOkButton,"clear-normal") 
        guiFgImage = guiCreateStaticImage(9,21,1261,333,"images/FGOfficialLogo.png",false,GUIFgWelcomeWindow) 
        guiEditor_Label[1] = guiCreateLabel(8,355,1271,570,"",false,GUIFgWelcomeWindow) 
        guiSetAlpha(GUIEditor_Label[1],1) 
        guiLabelSetColor(GUIEditor_Label[1],0, 155 ,155) 
        guiSetFont(GUIEditor_Label[1],"clear-normal") 
        guiFgRulesMemo = guiCreateMemo(2,5,1265,565,"                                                                                                                                               [FG] Rules !\n\n\n\n\n\n**********************************************************************************************************************************************************************************\n                                                                                                                             T H I S    I S   A   F R E E R O A M  !!!\n\n*DO NOT ADVERTISE !\n\n\n*DO NOT SPAM THE CHAT !\n\n\n*DO NO SPAM VEHICLES ! \n\n\n*DO NOT BE ANNOYING !\n\n\n*BE NICE, RESPECT OTHERS  !\n\n\n*DO NOT USE HACKS, CHEATS OR HANDLING CFG !\n\n\n***************************************************************\n\nAbove all, Have fun ! \n\n",false,GUIEditor_Label[1]) 
        guiMemoSetReadOnly(GUIFgRulesMemo,true) 
        guiEditor_Image[1] = guiCreateStaticImage(19,953,91,56,"images/shruk.png",false,GUIFgWelcomeWindow) 
        guiFgCheckBox = guiCreateCheckBox(398,940,343,72,"",false,false,GUIFgWelcomeWindow) 
        guiCheckBoxSetSelected(GUIFgCheckBox,true) 
        guiEditor_Memo[1] = guiCreateMemo(15,3,148,37,"I accept these Rules ! ",false,GUIFgCheckBox) 
    end 
) 
addEventHandler ( "onClientGUIClick", guiFgOkButton ) 
addEventHandler ( "onClientClick", getRootElement(), guiFgOkButton ) 
  

Posted

You had many errors here... try with this:

-- Created: 02/07/2011 09:45 
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        guiEditor_Memo = {} 
        guiEditor_Label = {} 
        guiEditor_Image = {} 
  
        guiFgWelcomeWindow = guiCreateWindow(77,262,1279,1023," R   U   L   E   S   ! ",false) 
        guiSetAlpha(GUIFgWelcomeWindow,1) 
        guiWindowSetSizable(GUIFgWelcomeWindow,false) 
        guiFgOkButton = guiCreateButton(564,943,172,59,"O  K  ! ",false,GUIFgWelcomeWindow) 
        guiSetAlpha(GUIFgOkButton,1) 
        guiSetFont(GUIFgOkButton,"clear-normal") 
        guiFgImage = guiCreateStaticImage(9,21,1261,333,"images/FGOfficialLogo.png",false,GUIFgWelcomeWindow) 
        guiEditor_Label[1] = guiCreateLabel(8,355,1271,570,"",false,GUIFgWelcomeWindow) 
        guiSetAlpha(GUIEditor_Label[1],1) 
        guiLabelSetColor(GUIEditor_Label[1],0, 155 ,155) 
        guiSetFont(GUIEditor_Label[1],"clear-normal") 
        guiFgRulesMemo = guiCreateMemo(2,5,1265,565,"                                                                                                                                               [FG] Rules !\n\n\n\n\n\n**********************************************************************************************************************************************************************************\n                                                                                                                             T H I S    I S   A   F R E E R O A M  !!!\n\n*DO NOT ADVERTISE !\n\n\n*DO NOT SPAM THE CHAT !\n\n\n*DO NO SPAM VEHICLES ! \n\n\n*DO NOT BE ANNOYING !\n\n\n*BE NICE, RESPECT OTHERS  !\n\n\n*DO NOT USE HACKS, CHEATS OR HANDLING CFG !\n\n\n***************************************************************\n\nAbove all, Have fun ! \n\n",false,GUIEditor_Label[1]) 
        guiMemoSetReadOnly(GUIFgRulesMemo,true) 
        guiEditor_Image[1] = guiCreateStaticImage(19,953,91,56,"images/shruk.png",false,GUIFgWelcomeWindow) 
        guiFgCheckBox = guiCreateCheckBox(398,940,343,72,"",false,false,GUIFgWelcomeWindow) 
        guiCheckBoxSetSelected(GUIFgCheckBox,true) 
        guiEditor_Memo[1] = guiCreateMemo(15,3,148,37,"I accept these Rules ! ",false,GUIFgCheckBox) 
        addEventHandler("onClientGUIClick", guiFgOkButton, function() 
        guiSetVisible(guiFgWelcomeWindow,false) 
        end, false) 
    end 
) 

P.S: Use the LUA tags next time.

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

Do you know what debugscript is? well, if you don't then go in-game and type /debugscript 3 and see if there's any error.

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 represents (nil value) here -.-

IDK how to fix it.

On guiEditor_Label[1]

 guiEditor_Label[1] = guiCreateLabel(8,355,1271,570,"",false,GUIFgWelcomeWindow) 
        guiSetAlpha(GUIEditor_Label[1],1) 
        guiLabelSetColor(GUIEditor_Label[1],0, 155 ,155) 
        guiSetFont(GUIEditor_Label[1],"clear-normal")  

Posted
That's because you didn't use showCursor(false)

here:

        addEventHandler("onClientGUIClick", guiFgOkButton, function() 
        guiSetVisible(guiFgWelcomeWindow,false) 
        showCursor(false) 
        end, false) 

Such a lazy guy isn't he?

He could have found out how to toggle cursor off if he used the wiki.

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

And one more question .

I have resoulution 1280x1024 and i see that GUI window normal.

My friend have resoulution 1024x768 and when he was joined the gui window has INCREASED to him, so he was unable to press OK button.

Is there any adjust screen resoultion for gui ?

Posted

With some mathes you can fit the gui in the middle for all resolutions here :

This is your window creation:

guiFgWelcomeWindow = guiCreateWindow(77,262,1279,1023," R   U   L   E   S   ! ",false) 

This is how to fit it in the middle for all resolutions:

local screenWidth, screenHeight = guiGetScreenSize() 
local x, y = screenWidth/2 - 1279/2, screenHeight/2 - 1023/2 
guiFgWelcomeWindow = guiCreateWindow(x,y,1279,1023," R   U   L   E   S   ! ",false) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

Client :

  
  
  
-- Created: 02/07/2011 09:45 
local screenWidth, screenHeight = guiGetScreenSize() 
local x, y = screenWidth/2 - 1279/2, screenHeight/2 - 1023/2 
  
  
  
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        guiEditor_Memo = {} 
        guiEditor_Label = {} 
        guiEditor_Image = {} 
  
         
        guiFgWelcomeWindow = guiCreateWindow(x,y,1279,1023," R   U   L   E   S   ! ",false) 
        guiSetAlpha(guiFgWelcomeWindow,1) 
        guiWindowSetMovable(guiFgWelcomeWindow,false) 
        guiWindowSetSizable(guiFgWelcomeWindow,false) 
        guiFgOkButton = guiCreateButton(564,943,172,59,"O  K  ! ",false,guiFgWelcomeWindow) 
        showCursor( true ) 
        guiSetAlpha(guiFgOkButton,1) 
        guiSetFont(guiFgOkButton,"clear-normal") 
        guiFgImage = guiCreateStaticImage(9,21,1261,333,"Logo.png",false,guiFgWelcomeWindow) 
        guiEditor_Label[1] = guiCreateLabel(8,355,1271,570,"",false,guiFgWelcomeWindow) 
        guiSetAlpha(guiEditor_Label[1],1) 
        guiLabelSetColor(guiEditor_Label[1],0, 155 ,155) 
        guiSetFont(guiEditor_Label[1],"clear-normal") 
        guiEditor_Memo[1] = guiCreateMemo(2,5,1265,565,"                                                                                                                Welcome To [FG]Clan 24/7 Croatian Playground Freeroam      \n\n\n\nPress F9 for any HELP or Commands. \n\n**********************************************************************************************************************************************************************************\nFreeroam Rules:\n                                                                                                                             \n\n*DO NOT ADVERTISE !\n\n*DO NOT SPAM THE CHAT !\n\n*DO NOT SPAM VEHICLES ! \n\n*DO NOT ANNOY OTHERS !\n\n*BE NICE, RESPECT OTHERS  !\n\n*DO NOT USE HACKS, CHEATS OR HANDLING CFG !\n\n*DO NOT BOTHER STAFF !\n\n\n\n**********************************************************************************************************************************************************************************\n\nAtleast, you will be warned 2 times before BAN !\n\n\nAbove all, Have fun ! \n",false,guiEditor_Label[1]) 
        guiMemoSetReadOnly(guiFgRulesMemo,false) 
        guiEditor_Image[1] = guiCreateStaticImage(19,953,91,56,"Shruk.png",false,guiFgWelcomeWindow) 
        addEventHandler("onClientGUIClick", guiFgOkButton, function() 
        guiSetVisible(guiFgWelcomeWindow,false) 
        showCursor(false) 
        end, false) 
    end 
) 

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