Author Topic: GUI Help  (Read 2098 times)

Raiden

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
GUI Help
« on: January 08, 2012, 07:03:14 pm »
Since Im a total noob in GUI, idk how to make this.
Basicly Im trying to make the M button to display a Map pic of the whole liberty
I took an example from Juppi's speedo script but still failed.
Here is the code:

Script.xml
Code: [Select]
<script file="MAPGUI.nut" client="1"/>

<sprite file="gta3map.png" />


MAPGUI.nut
Code: [Select]
// Map settings
g_bEnabled <- true;
g_vMapPos <- VectorScreen( ScreenWidth - 0, ScreenHeight - 0 );

/*
 * LU Events
 */
 
 function onScriptLoad()
{
print( "Version 0.1, written by [VU_R]Raiden" );

BindKey( 'M', BINDTYPE_DOWN, "Map", player );

// Create sprites
::g_Map <- GUISprite( "gta3map.png", ::g_vMapPos );
::g_Map.Visible = false;

// Add layers for each sprite so that they are rendered
AddGUILayer( ::g_Map );


return 1;
}
 
function Map()
{
::g_Map.Visible = true;
}

And the Sprites folder which contains the file.

Scripts
    Map
        Sprites
            gta3map.png
« Last Edit: January 08, 2012, 07:08:10 pm by Raiden »

Raiden

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: GUI Help
« Reply #1 on: January 08, 2012, 08:51:13 pm »
Hmm, nope aint working.

PS: VectorScreen( ScreenWidth - 0, ScreenHeight - 0 ); is the center right?

Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-73
    • View Profile
Re: GUI Help
« Reply #2 on: January 08, 2012, 08:58:08 pm »
Center is VectorScreen(ScreenWidth / 2, ScreenHeight /2);

Raiden

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: GUI Help
« Reply #3 on: January 09, 2012, 12:57:02 am »
Removed the bind and tried with a ClientCommand and failed.

Code: [Select]
g_pLocalPlayer <- FindLocalPlayer();
g_bEnabled <- true;
g_vmapPos <- VectorScreen( ScreenWidth - 2, ScreenHeight - 2 ); //edit this with your position
g_map <- GUISprite( "gta3map.png",  ::g_vmapPos ); //edit if file name or extension is different

function onScriptLoad()
{
g_map.Visible = true;

AddGUILayer( g_map );

g_pLocalPlayer <- FindLocalPlayer();

return 1;
}

function onClientCommand( cmd, text )
{
if ( cmd == "map" )
{
if ( ( text ) && ( text == "off" ) )
{
::g_bEnabled = false;
}
else
{
::g_bEnabled = true;
}
}

return 1;
}

Prints Invalid Cmd all the time

Raiden

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: GUI Help
« Reply #4 on: January 10, 2012, 09:54:04 am »
Nope, doesn't work. It prints only the message not the pic.

Demi God

  • Newbie
  • *
  • Posts: 20
  • Karma: +1/-1
    • View Profile
Re: GUI Help
« Reply #5 on: January 11, 2012, 01:02:58 pm »
Make sure the picture is present in the folder and its name is "map.png"
Liberty Unleashed daily user!
[DW] Clan owner!
[DW] || Battle-Grounds server owner!
Click here to join us!

 

© Liberty Unleashed Team.