Author Topic: INI Help  (Read 2383 times)

Demi God

  • Newbie
  • *
  • Posts: 20
  • Karma: +1/-1
    • View Profile
INI Help
« on: February 01, 2012, 01:31:53 pm »
Command:

Code: [Select]
(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:

Code: [Select]
<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:

Code: [Select]
function onScriptLoad()
{
  LoadModule("lu_ini");
  print( "** Scripts loaded sucessfully" );
  return 1;
}
Liberty Unleashed daily user!
[DW] Clan owner!
[DW] || Battle-Grounds server owner!
Click here to join us!

Demi God

  • Newbie
  • *
  • Posts: 20
  • Karma: +1/-1
    • View Profile
Re: INI Help
« Reply #1 on: February 01, 2012, 03:00:53 pm »
Code: [Select]
    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

Code: [Select]
function LoadHashes()
{
    SavedLocs <- HashTable( "Hashes/SavedLocs.hsh" );
    SavedLocs.Load( "Hashes/SavedLocs.hsh" );
   
    return 1;
}

Thanks, so whats the use of INI?
Liberty Unleashed daily user!
[DW] Clan owner!
[DW] || Battle-Grounds server owner!
Click here to join us!

stormeus

  • No-Lifer
  • Developer
  • Full Member
  • *****
  • Posts: 112
  • Karma: +13/-2
    • View Profile
Re: INI Help
« Reply #2 on: February 01, 2012, 09:27:50 pm »
INIs are gross.
Quote
Morphine says:
    them LU devs ranting about how LU doesn't have client pickups
    while us VC:MPers don't have client anything
    ;_;

Stormeus Argo says:
    we have client crashes though
    ohohohohoho

Morphine says:
    LU DOESN'T HAVE THAT

Stormeus Argo says:
    LU - 0
    VC:MP - 1

SugarD

  • Argonath RPG Dev/Manager
  • Tester
  • Sr. Member
  • ****
  • Posts: 820
  • Karma: +37/-75
  • STOP IN THE NAME OF THE COLESLAW!
    • View Profile
    • Clan Xperience
Re: INI Help
« Reply #3 on: February 02, 2012, 03:31:45 am »
INIs are gross.
That wasn't very nice...or helpful. D:

VetalYA

  • Guest
Re: INI Help
« Reply #4 on: February 06, 2012, 06:08:35 pm »
No. INIs are useful, because of simplicity of usage :)   :D

ElGringo

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: INI Help
« Reply #5 on: August 06, 2013, 12:43:42 pm »
i need help in the ini
i loaded VBS but the most of the cmds not working
it says invalid command plzz help me >_<

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
Re: INI Help
« Reply #6 on: August 06, 2013, 01:19:33 pm »
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



 

© Liberty Unleashed Team.