Author Topic: I need help for two commands  (Read 4291 times)

TALA

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
I need help for two commands
« on: April 02, 2011, 08:51:08 pm »
Hello
In this server ---> 178.63.100.139:5190 have a two commads, which save and load your position
They are /saveloc and /gotoloc
With /saveloc you save your position and with /gotoloc you teleported to saved position
I needed this commands.Please give me the script of the commands or how to created ?

Sorry for my bad english :-\

matheo

  • Jr. Member
  • **
  • Posts: 87
  • Karma: +2/-20
  • Virtual owners - Clan Leader
    • View Profile
Re: I need help for two commands
« Reply #1 on: April 02, 2011, 09:09:36 pm »
Hi TALA!
You want create in your server a commands "/saveloc" and "/gotoloc"

Please read this:
http://forum.liberty-unleashed.co.uk/index.php?topic=391.0

If you download this script

Folder "LocationSaver" Please paste in folder Scripts

When you paste please come to folder LU->content.xml (in content please press right key mouse)

and add in the down
Quote
<script folder="LocationSaver" />


Save and Turn you server ;=]
We recrutiment to clan !!! ;-)

TALA

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: I need help for two commands
« Reply #2 on: April 02, 2011, 09:15:06 pm »
You not understand me, i want command for save position in-game and with other command teleport to te saved position, join in the server and see the commands /saveloc and /gotoloc

D4RiFT

  • Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: I need help for two commands
« Reply #3 on: April 03, 2011, 12:15:06 am »
You not understand me, i want command for save position in-game and with other command teleport to te saved position, join in the server and see the commands /saveloc and /gotoloc
Yes, download that script., To add onplayjoin commands, simply, look on the wiki site and find the command to put on playerjoin. The location saver works, just have a good look on the wiki site to find the command to show on PLAYERJOIN.. thanks

Orpheus

  • Newbie
  • *
  • Posts: 49
  • Karma: +1/-0
  • Music is a way of life.
    • View Profile
    • Orphtown UK
Re: I need help for two commands
« Reply #4 on: April 03, 2011, 02:15:09 am »
You would have to save the positions with a name, for either the position or the person who saved it, Personally I would use a hash table for this, if you look in FBS or on the wiki you can find some good examples of how to use hashes.
Then /saveloc would save something like the x,y,z,facing angle, and then getloc would load the same based on the name given to each

Regards Orpheus

Windows: A 64-bit/32-bit extension to a 16-bit GUI on an 8-bit OS written for a 4-bit architecture by a 2-bit company who can not stand 1-bit of competition.

TALA

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: I need help for two commands
« Reply #5 on: April 03, 2011, 09:54:58 pm »
Thanks all for help, but i'm not good scripter and that you told me not help me make a script commands.  :-\
Do you will make script ready for the commands ?

Sorry for bad english :-\

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: I need help for two commands
« Reply #6 on: April 04, 2011, 08:11:26 am »
Sorry, But we're here to help not to deliver.
Try looking at the wiki located here
If you get stuck we're happy to help ;)

TALA

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: I need help for two commands
« Reply #7 on: April 04, 2011, 07:07:29 pm »
The admin of the server give me the script of the commands, but still commands is not working
Here the script:

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

function onPlayerCommand( player, cmd, params )
{
   if ( cmd == "saveloc" )
   {
      if ( !params ) MessagePlayer( "[#04a36b]Syntax: /saveloc [Name]", player );
      else
      {
         local pos = player.Pos, formatize = format( "%.10f", pos.x ) + "," + format( "%.10f", pos.y ) + "," + format( "%.10f", pos.z ) + "," + format( "%.10f", player.Angle );
         SavedLocs.Add( params, formatize );
         SavedLocs.Save( "SavedLocs.hsh" );
         MessagePlayer( "[#04a36b]Your current position saved as " + params, player );
      }
   }
   else if ( cmd == "gotoloc" )
   {
      if ( !params ) MessagePlayer( "[#04a36b]Syntax: /gotoloc [Name]", player );
      else if ( !SavedLocs.Get( params ) ) MessagePlayer( "[#ff0000]Error - [#04a36b]Location does not exist.", player );
      else
      {
         local coords = SavedLocs.Get( params ), spl = split( coords, "," );
         local newpos = Vector( spl[ 0 ].tofloat(), spl[ 1 ].tofloat(), spl[ 2 ].tofloat() );
           
         player.Pos = newpos;
         player.Angle = spl[ 3 ].tofloat();
         MessagePlayer( "[#04a36b]Teleporting to location:[ " + params + "]", player );
      }
   }
}

Where is the miskate ?

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: I need help for two commands
« Reply #8 on: April 04, 2011, 07:56:18 pm »
It looks ok, Are you sure you're loading this script?

TALA

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: I need help for two commands
« Reply #9 on: April 04, 2011, 08:11:46 pm »
Yea, i make new .nut file and it paste the script, i renamed file - SL.nut
Then i create a new Script.xml and paste this <script file="SL.nut" client="0"/>
And finally i open content.xml and paste this <script folder="SL" />

And the commands doesn't, but when i type /saveloc show this - Syntax: /saveloc [Name]
But when i type example: /saveloc axa nothing shows and the commands /gotoloc axa doesn't work

matheo

  • Jr. Member
  • **
  • Posts: 87
  • Karma: +2/-20
  • Virtual owners - Clan Leader
    • View Profile
Re: I need help for two commands
« Reply #10 on: April 04, 2011, 09:10:03 pm »
Maybe turn a uptades in server if no i see this script and edit ;)
We recrutiment to clan !!! ;-)

TALA

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: I need help for two commands
« Reply #11 on: April 04, 2011, 09:18:10 pm »
I turn Updater.exe and again doesn't work the commands.I don't know what to do.
Here the text of the ScriptLog.log

Code: [Select]
<04/04/2011 - 18:15:26> - Pickup Handling Script Loaded
<04/04/2011 - 18:15:56>
AN ERROR HAS OCCURED [wrong number of parameters]

<04/04/2011 - 18:15:56>
CALLSTACK

<04/04/2011 - 18:15:56>
LOCALS

<04/04/2011 - 18:15:56>
AN ERROR HAS OCCURED [getVarInfo: Could not retrieve UserData]

<04/04/2011 - 18:15:56>
CALLSTACK

<04/04/2011 - 18:15:56> *FUNCTION [onPlayerCommand()] Scripts/SL/SL.nut line [15]

<04/04/2011 - 18:15:56>
LOCALS

<04/04/2011 - 18:15:56> [formatize] "98.9099960327,-951.1000366211,26.1599998474,8.1635065079"

<04/04/2011 - 18:15:56> [pos] INSTANCE

<04/04/2011 - 18:15:56> [params] "test"

<04/04/2011 - 18:15:56> [cmd] "saveloc"

<04/04/2011 - 18:15:56> [player] INSTANCE

<04/04/2011 - 18:15:56> [this] TABLE

<04/04/2011 - 18:16:02>
AN ERROR HAS OCCURED [wrong number of parameters]

<04/04/2011 - 18:16:02>
CALLSTACK

<04/04/2011 - 18:16:02>
LOCALS

<04/04/2011 - 18:16:02>
AN ERROR HAS OCCURED [getVarInfo: Could not retrieve UserData]

<04/04/2011 - 18:16:02>
CALLSTACK

<04/04/2011 - 18:16:02> *FUNCTION [onPlayerCommand()] Scripts/SL/SL.nut line [23]

<04/04/2011 - 18:16:02>
LOCALS

<04/04/2011 - 18:16:02> [params] "test"

<04/04/2011 - 18:16:02> [cmd] "gotoloc"

<04/04/2011 - 18:16:02> [player] INSTANCE

<04/04/2011 - 18:16:02> [this] TABLE

<04/04/2011 - 18:16:15> - Pickup Handling Script Unloaded

Tamas

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
    • LCDM
Re: I need help for two commands
« Reply #12 on: April 04, 2011, 10:58:10 pm »
There is nothing wrong with that script, you've messed up something I guess.

VRocker

  • Liberty Unleashed Developer
  • Administrator
  • Full Member
  • ******
  • Posts: 342
  • Karma: +43/-15
    • View Profile
    • Madnight Software
Re: I need help for two commands
« Reply #13 on: April 05, 2011, 01:13:44 am »
Are you calling LoadHashes? seems like your not so the SavedLocs pointer is invalid. Call LoadHashes when the script starts and it should work


TALA

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: I need help for two commands
« Reply #14 on: April 05, 2011, 04:08:47 pm »
So how to Call LoadHashes ?

 

© Liberty Unleashed Team.