Guest User

Willkommensbox

a guest
May 14th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. localPlayer = getLocalPlayer()
  2.  
  3. wnd_window = {}
  4.  
  5. addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ),
  6. function ( theResource )
  7. --outputConsole( "wnd_showServerInfo called" )
  8. --outputConsole( " source: ".. tostring( source ) )
  9. --outputConsole( " resourceStarted: ".. tostring( theResource ) )
  10. if source == getResourceRootElement( theResource ) then
  11. --outputConsole( " passed if: source == resource" )
  12. local xml = xmlLoadFile( "server.xml" )
  13. local contents = xmlNodeGetValue( xml )
  14. wnd_create( "Herzlich Willkommen auf Mars Reallife", "Willkommen/logo.jpg", contents )
  15. end
  16. end
  17. )
  18.  
  19. function wnd_close()
  20. guiSetVisible( wnd_window.wnd, false )
  21. showCursor( false )
  22. end
  23.  
  24. addEvent( "window_text", true )
  25. function wnd_create( title, logo, content )
  26. --outputConsole( "wnd_create called" )
  27. if not wnd_window.wnd then
  28. --outputConsole( " passed if" )
  29. wnd_window.wnd = guiCreateWindow( 0.1, 0.15, 0.8, 0.7, title, true )
  30. guiWindowSetSizable( wnd_window.wnd, false )
  31. guiWindowSetMovable( wnd_window.wnd, false )
  32.  
  33. wnd_window.logo = guiCreateStaticImage( 0.05, 0.1, 0.9, 0.5, logo, true, wnd_window.wnd )
  34.  
  35. --wnd_window.text = content
  36. wnd_window.memo = guiCreateMemo( 0, 0.3, 1, .6, content, true, wnd_window.wnd )
  37. guiMemoSetReadOnly( wnd_window.memo, true )
  38.  
  39. wnd_window.close_btn = guiCreateButton( 0, .91, .3, 1, "Close", true, wnd_window.wnd )
  40. --outputConsole( " window created: ".. tostring( wnd_window.wnd ) )
  41. showCursor( true )
  42. addEventHandler( "onClientGUIClick", wnd_window.close_btn, wnd_close )
  43. end
  44. end
  45. addEventHandler( "window_text", getRootElement(), wnd_create )
Advertisement
Add Comment
Please, Sign In to add comment