Liberty Unleashed
Scripting => Script Help => Topic started by: Merkel on September 02, 2013, 12:57:40 pm
-
What is wrong ?
function InitStatsTimer( plr )
{
local pos = plr.Pos;
local health = plr.Health;
local armour = plr.Armour;
local FormatPos = format( pos.x + "," + pos.y + "," + pos.z );
local FormatWeapon = format( plr.Weapon + "," + plr.WeaponAmmo );
SetHealth( plr.Name, health );
SetArmour( plr.Name, armour );
SetWeapon( plr.Name, FormatWeapon );
SetPosition( plr.Name, FormatPos );
SaveStatHashes();
}
function ProcessPlayerStatsLog( plr )
{
plr.Health = GetHealth( plr.Name );
plr.Armour = GetArmour( plr.Name );
plr.SetWeapon( GetWeapon( plr.Name ) );
plr.Pos = Vector( GetPosition( plr.Name ) );
if ( !plr.Spawned ) plr.Spawn();
}
Say error in
plr.Pos = Vector( GetPosition( plr.Name ) );
Lol.
-
Show function "GetPosition" please
-
function GetPosition( name )
{
local pos = zPosition.Get( name.tolower() );
if ( pos != null )
return pos;
}
-
zPosition.Get() isn't LU function. What is it? Where did you get it?
-
You Can Make This Function Easily By Hash. ;)
-
zPosition <- HashTable( "Position" );
function LoadStatHashes()
{
zPosition.Load( "Hashes/DSS/PlayerStats/Position.hsh" );
}
function SaveStatHashes()
{
zPosition.Save( "Hashes/DSS/PlayerStats/Position.hsh" );
}
function CloseStatHashes()
{
zPosition.Close();
zPosition <- null;
}
L0L
-
And last, show hash file :D
-
You Can Get The Idea From This >>
function onScriptLoad()
{
LoadHashes();
}
function LoadHashes()
{
Spawns <- HashTable( "Hashes/Spawns.hsh" );
Spawns.Load( "Hashes/Spawns.hsh" );
}
function onPlayerSpawn( pPlayer, Spawned )
{
Spawns.Inc( pPlayer.Name, 1 );
Spawns.Save( "Hashes/Spawns.hsh" );
if(Spawns.Get( pPlayer.Name ) != null) MessagePlayer( "Spawns: " + Spawns.Get( pPlayer.Name ), pPlayer, Colour( 0, 255, 0 ) );
else MessagePlayer( "Spawns: 0", pPlayer, Colour( 0, 255, 0 ) );
}
-
All those code is not needed. You can tell the error from the first snippet he posed.
Vector needs 3 parameters: x, y and z. You're giving it a string contain "X Y Z". That wouldn't work that way.
local pos = GetPosition( plr.Name );
plr.Pos = Vector( GetTok(pos,", ",1).tofloat(), GetTok(pos,", ",2).tofloat(), GetTok(pos,", ",3).tofloat() );
-
Thank Thijn.
And, the pos is not save?
And, how I save the weapons?
Sorry by many questions xD
-
Thank Thijn.
And, the pos is not save?
And, how I save the weapons?
Sorry by many questions xD
You Can Save The Weapons Like Pos But You Cant Save The All Weapons.