Liberty Unleashed
Scripting => Script Help => Topic started by: Demi God on February 01, 2012, 12:31:53 pm
-
Command:
(3)if ( cmd == "s" )
(4) {
(5) local pos = player.Pos;
(6) if( text )
(7) {
(8) MessagePlayer( "Saved location: " + pos.x + "," + pos.y + "," + pos.z + " as " + text + ".", player );
(9) WriteIniFloat( "Locations.ini", text, "x", pos.x );
(10) WriteIniFloat( "Locations.ini", text, "y", pos.y );
(11)WriteIniFloat( "Locations.ini", text, "z", pos.z );
(12) }
(13) else MessagePlayer("Error: /s (location_name)",player);
(14) }
The problem is when i type /s (text), It doesn't save the anything in-game instead it prints the following text in Rcon:
<31/01/2012 - 21:07:37> *FUNCTION [onPlayerCommand()] Scripts/Main/main.nut line [9]
<31/01/2012 - 21:07:37> LOCALS
<31/01/2012 - 21:07:37> [pos] INSTANCE
<31/01/2012 - 21:07:37> [text] "Bank"
<31/01/2012 - 21:07:37> [cmd] "s"
<31/01/2012 - 21:07:37> [player] INSTANCE
<31/01/2012 - 21:07:37> [this] TABLE
I have loaded the required module:
function onScriptLoad()
{
LoadModule("lu_ini");
print( "** Scripts loaded sucessfully" );
return 1;
}
-
else if ( szCommand == "saveloc" )
{
if ( !szParams ) MessagePlayer( "*PM* Usage: /" + szCommand + " <name>", pPlayer, Colour( 255, 0, 0 ) );
else
{
if ( pPlayer.Spawned )
{
local pos = pPlayer.Pos, formatize = format( "%.10f", pos.x ) + "," + format( "%.10f", pos.y ) + "," + format( "%.10f", pos.z ) + "," + format( "%.10f", pPlayer.Angle );
SavedLocs.Add( szParams, formatize );
SavedLocs.Save( "Hashes/SavedLocs.hsh" );
MessagePlayer( "*PM* Location saved as: " + szParams, pPlayer, Colour( 0, 255, 0 ) );
}
else MessagePlayer( "*PM* Error: You are not spawned. Press CTRL to spawn", pPlayer, Colour( 255, 0, 0 ) );
return 1;
}
}
else if ( szCommand == "gotoloc" )
{
if ( !szParams ) MessagePlayer( "*PM* Usage: /" + szCommand + " <name>", pPlayer, Colour( 255, 0, 0 ) );
else
{
if ( SavedLocs.Get( szParams ) )
{
if ( pPlayer.Spawned )
{
local coords = SavedLocs.Get( szParams ), spl = split( coords, "," );
local newpos = Vector( spl[ 0 ].tofloat(), spl[ 1 ].tofloat(), spl[ 2 ].tofloat() );
pPlayer.Pos = newpos;
pPlayer.Angle = spl[ 3 ].tofloat();
MessagePlayer( "*PM* You teleported to location: " + szParams, pPlayer, Colour( 0, 255, 0 ) );
}
else MessagePlayer( "*PM* Error: You are not spawned. Press CTRL to spawn", pPlayer, Colour( 255, 0, 0 ) );
}
else MessagePlayer( "*PM* Error: That location does not exist in the database", pPlayer, Colour( 255, 0, 0 ) );
return 1;
}
}
also
function LoadHashes()
{
SavedLocs <- HashTable( "Hashes/SavedLocs.hsh" );
SavedLocs.Load( "Hashes/SavedLocs.hsh" );
return 1;
}
Thanks, so whats the use of INI?
-
INIs are gross.
-
INIs are gross.
That wasn't very nice...or helpful. D:
-
No. INIs are useful, because of simplicity of usage :) :D
-
i need help in the ini
i loaded VBS but the most of the cmds not working
it says invalid command plzz help me >_<
-
i need help in the ini
i loaded VBS but the most of the cmds not working
it says invalid command plzz help me >_<
I Know, But You Can Tell Us The Command Witch You Need In The VBS Script And We Will Help You :D