Requires the lu_ini Module!I have not played with a Ini system in sometime.
I wanted to remove hashes from the Worst server and rebuild all of the saved hashes to Ini.
The origanal location system started from
http://forum.liberty-unleashed.co.uk/index.php/topic,985.msg6245.html#msg6245Released by Svenko, Unless I'm wrong with the script.
Ini can be rather funny compared to other systems. Others might know this as well.
Hoping someone could find use of this.
Enjoy
function onScriptLoad() {
if ( LoadModule("lu_ini")) {
print( "lu_ini module loaded" );
}
else print( "Error: Loading of lu_ini module failed." );
}
//------------------------------------------------------------------------------
function onPlayerCommand( player, cmd, text ) {
if ( cmd == "saveloc" ) {
local x = ReadIniFloat( "Locations.ini", text, "X" ), y = ReadIniFloat( "Locations.ini", text, "Y" ), z = ReadIniFloat( "Locations.ini", text, "Z" );
if (!x, !y, !z) {
WriteIniFloat( "Locations.ini", text, "X", player.Pos.x );
WriteIniFloat( "Locations.ini", text, "Y", player.Pos.y );
WriteIniFloat( "Locations.ini", text, "Z", player.Pos.z );
MessagePlayer( "Saved location " + text + ".", player, Colour( 225, 225, 225 ) );
}
else MessagePlayer( "The saved location " + text + " already exist!!", player, Colour( 255, 0, 0 ) );
return true;
}
if ( cmd == "gotoloc" ) {
local x = ReadIniFloat( "Locations.ini", text, "X" ), y = ReadIniFloat( "Locations.ini", text, "Y" ), z = ReadIniFloat( "Locations.ini", text, "Z" );
if (x,y,z) {
MessagePlayer( "Going to location " + text + ".", player, Colour( 225, 225, 225 ));
player.Pos = Vector(x, y, z);
}
else MessagePlayer( "Going to location " + text + " FAILED!!", player, Colour( 255, 0, 0 ) );
return true;
}
return false;
}