The admin of the server give me the script of the commands, but still commands is not working
Here the script:
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 ?