Liberty Unleashed
Scripting => Script Help => Topic started by: Raiden on January 08, 2012, 06: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
<script file="MAPGUI.nut" client="1"/>
<sprite file="gta3map.png" />
MAPGUI.nut
// 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
-
Hmm, nope aint working.
PS: VectorScreen( ScreenWidth - 0, ScreenHeight - 0 ); is the center right?
-
Center is VectorScreen(ScreenWidth / 2, ScreenHeight /2);
-
Removed the bind and tried with a ClientCommand and failed.
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
-
Nope, doesn't work. It prints only the message not the pic.
-
Make sure the picture is present in the folder and its name is "map.png"