Can it be possible

Started by FinchDon, Sep 13, 2015, 03:47 PM

Previous topic - Next topic

Thijn

Quote from: KAKAN on Sep 14, 2015, 05:16 PMHehe, the problem is FinnchDon don't have a simple time function....
function time()
{
    local t = date();
    return ::format(@"%.2d/%.2d/%d - %.2d:%.2d:%.2d", t.day, t.month, t.year, t.hour, t.min, t.sec);
}

else @Kusanagi I would like to request ya to post your time function
*facepalm*

time() is standard Squirrel function that will return a unix timestamp. Please, go read the manual some day.



Quote from: Kusanagi on Sep 14, 2015, 11:21 AMCaution:its an untested idea perhaps it works

onScriptLoad()
{
LastKillTime < array(GetMaxPlayers(), null );
}

onPlayerKill( player, killer, reason, bodypart )
{
if ( LastKillTime[killer.ID] == null ) LastKillTime[killer.ID] = time();
if((time()- LastKillTime[killer.ID]) < 1000) // if time is less than 1 sec
{
// your funny script here
}
}
That will never work since you set the value before checking the previous one. This will always return true.

KAKAN

Quote from: Thijntime() is standard Squirrel function that will return a unix timestamp. Please, go read the manual some day.
I thought it was deprecated, sorry
Oh it was GetTIme
And yes, where can i find the manual?
oh no

Thijn


FinchDon

@Beztone i tried your code But When i kill first time it show Announcemnet Double Kil as i add announcement but it show on first kill
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

Quote from: ThijnThat will never work since you set the value before checking the previous one. This will always return true.
1st read this all
oh no

MacTavish

@Thijn i already mention that was an untested idea

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Debian

Quote from: FinchDon on Sep 15, 2015, 09:30 AM@Beztone i tried your code But When i kill first time it show Announcemnet Double Kil as i add announcement but it show on first kill

did you tried mine?

KAKAN

He just can't understand what u meant
oh no

Debian

#23
Tested, Nice idea

function onScriptLoad(){

stats <- array( GetMaxPlayers(), 0 );

print(" Debian Loaded" );
}


function onPlayerJoin( player ){

stats[ player.ID ] = PlayerClass( player.Name );

}

function onPlayerPart( player, reason ){

stats[ player.ID ] = null; 

}

class PlayerClass{
// ------------------------------------------------------------------- //

Lastkill = 0;
Killcount = 0;
}


function onPlayerKill( killer, player, reason, bodypart )
{
if ( (time() - stats[killer.ID].Lastkill) <= 2 ) {
stats[killer.ID].Killcount++;
Message(killer.Name + "has killed "+stats[killer.ID].Killcount+"players  in 2s time.");
}else {
stats[killer.ID].Lastkill = time();
stats[killer.ID].Killcount = 1;
}
}


Update 1 : player.ID to killler.ID