Liberty Unleashed

Scripting => Script Help => Topic started by: Dan97 on May 18, 2014, 01:07:27 am

Title: Save Score
Post by: Dan97 on May 18, 2014, 01:07:27 am
Well, I need a script to save score, but I can't make this, because I can't make a scritp for Hashes, who can help me?
Title: Re: Save Score
Post by: Thijn on May 18, 2014, 10:11:57 am
Take a look in the Script releases board. There's a few scripts that can save score.
Title: Re: Save Score
Post by: Dan97 on May 23, 2014, 01:49:09 am
Why this is crash my server? What is wrong?

function onScriptLoad()
{
        LoadHashes();
}
function onScriptUnload()
{
   SaveHashes();
   CloseHashes();
}
function CreateHashes()
{
   Kills<- HashTable( "Kills" );
   Deaths<- HashTable( "Deaths" );
}   
function SaveHashes()
{
        Kills.Save( "Hashes/Kills.hsh" );
        Deaths.Save( "Hashes/Deaths.hsh" );   
}
function LoadHashes()
{
        CreateHashes();
        Kills.Load( "Hashes/Kills.hsh" );
        Deaths.Load( "Hashes/Deaths.hsh" );
}
function CloseHashes()
{
   Kills.Close();
   Deaths.Close();
   Kills<- null;
   Deaths<- null;
}
function onPlayerConnect( pPlayer )
{   
        pPlayer.Score = Kills.Get( pPlayer );
}
function onPlayerKill( pKiller, pKilled, iWeapon, iBodyPart )
{
   /* Get the weapon name and the body part name, putting in an offset for its Unknown */
   local szWeapon = GetWeaponName( iWeapon ), szBodyPart = GetBodyPartName( iBodyPart );
   
   if ( szBodyPart == "Unknown" ) szBodyPart = "Body";
   
   Message( "[#0080ff]" + pKiller + " killed " + pKilled + " (" + szWeapon + ") (" + szBodyPart + ")", Colour( 255, 0, 0 ) );
   pKiller.Score += 1;
    Kills.Inc( pKiller, 1 );
    Deaths.Inc( pKilled, 1 );
}
Title: Re: Save Score
Post by: Merkel on May 23, 2014, 06:35:28 pm
Why this is crash my server? What is wrong?

** code **

Try ...

Code: [Select]
Kills <- HashTable ( "Kills" );
Deaths <- HashTable ( "Deaths" );

function onScriptLoad ( ) {

Kills.Load ( "Hashes/Kills.hsh" );
Deaths.Load ( "Hashes/Deaths.hsh" );
}

function onScriptUnload ( ) {

Kills.Save ( "Hashes/Kills.hsh" );
Deaths.Save ( "Hashes/Deaths.hsh" );

Kills.Close ( );
Deaths.Close ( );

Kills <- null;
Deaths <- null;
}

function onPlayerConnect ( pPlayer ) {

pPlayer.Score = Kills.Get ( pPlayer );
}

function onPlayerKill ( Killer, Killed, Weapon, Part ) {

if ( Part == "Unknown" ) Part = "Body";

Message( "[#0080ff]" + Killer + " killed " + Killed + " (" + GetWeaponName ( Weapon ) + ") (" + GetBodyPartName ( Part ) + ")" );

pKiller.Score ++;

    Kills.Inc ( Killer, 1 );
    Deaths.Inc ( Killed, 1 );
}

offtopic -> i'm banned from the forum, for use the forum i need use Proxy's
Title: Re: Save Score
Post by: Thijn on May 23, 2014, 08:04:13 pm
offtopic -> i'm banned from the forum, for use the forum i need use Proxy's
You are being caught in a subnet ban belonging to IMMORTAL. Who has been permanently banned for spreading all kinds of harmful files. Unfortunately we're not going to unban those subnets, so as long as you have the 88.1*.*.* subnet you need to find another way to access our forum.
Title: Re: Save Score
Post by: Merkel on May 23, 2014, 08:11:40 pm
offtopic -> i'm banned from the forum, for use the forum i need use Proxy's
You are being caught in a subnet ban belonging to IMMORTAL. Who has been permanently banned for spreading all kinds of harmful files. Unfortunately we're not going to unban those subnets, so as long as you have the 88.1*.*.* subnet you need to find another way to access our forum.

Oh, k.

(movistar and dynamic ip, some times i can use the forums, others times nope... [every day change])

p.s.: who is INMORTAL?