Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: FinchDon on Sep 13, 2015, 03:47 PM

Title: Can it be possible
Post by: FinchDon on Sep 13, 2015, 03:47 PM
Hello friends i was playing Unreal Tournament 1999 I saw their if you kill two players at a Time Distance of 2 seconds then it show Double Kill if another kill in 2 seconds it show MultiKill then Ultra. Can it be Possible ? in VCMP
Title: Re: Can it be possible
Post by: Thijn on Sep 13, 2015, 04:01 PM
Yes. Just keep track of the time of the last kill and see if it's within 2 seconds, then act like you would for a killing spree.
Really easy to do.
Title: Re: Can it be possible
Post by: KAKAN on Sep 13, 2015, 04:17 PM
Quote from: Thijn on Sep 13, 2015, 04:01 PMYes. Just keep track of the time of the last kill and see if it's within 2 seconds, then act like you would for a killing spree.
Really easy to do.
Yea, Exactly!
Things you need:-
1. A IDEA
2. Some scripting skills
Title: Re: Can it be possible
Post by: Debian on Sep 13, 2015, 04:50 PM
Nice idea
Title: Re: Can it be possible
Post by: . on Sep 13, 2015, 04:55 PM
I'm not even sure what's so hard to implement :-\ People scripted these in games since forever. Take CS 1.6 for example.
Title: Re: Can it be possible
Post by: FinchDon on Sep 14, 2015, 02:06 AM
Unreal Best For Ideas Can i Get Example?
Title: Re: Can it be possible
Post by: Thijn on Sep 14, 2015, 05:47 AM
Quote from: FinchDon on Sep 14, 2015, 02:06 AMUnreal Best For Ideas Can i Get Example?
I give you the idea. Execute it. It's really easy if you think about it. Try it.
I'll give you a tiny bit of the logic.
if ( (time() - <lastkilltime killer>) <= 2 ) {
Title: Re: Can it be possible
Post by: FinchDon on Sep 14, 2015, 09:10 AM
Thank You @Thijn I will try
Title: Re: Can it be possible
Post by: FinchDon on Sep 14, 2015, 10:23 AM
I tried Your Code @Thijn Lol Its Say's Error Expression Expected

Line 921

if ( (time() - <lastkilltime killer>) <= 100 )
Title: Re: Can it be possible
Post by: Drake on Sep 14, 2015, 10:30 AM
Quote from: FinchDon on Sep 14, 2015, 10:23 AMI tried Your Code @Thijn Lol Its Say's Error Expression Expected

Line 921

if ( (time() - <lastkilltime killer>) <= 100 )
*facepalm*
Title: Re: Can it be possible
Post by: EK.IceFlake on Sep 14, 2015, 10:36 AM
Quote from: Drake on Sep 14, 2015, 10:30 AM
Quote from: FinchDon on Sep 14, 2015, 10:23 AMI tried Your Code @Thijn Lol Its Say's Error Expression Expected

Line 921

if ( (time() - <lastkilltime killer>) <= 100 )
*facepalm*
Facepalm
Title: Re: Can it be possible
Post by: Debian on Sep 14, 2015, 11:14 AM
not tested,
make a lastkill in player class or store value somewhere for a player mostly in array

if ( (time() - stats[player.ID].Lastkill) <= 2 ) {
Message("Finchdon finally made it");
}else stats[player.ID].Lastkill = time();

 


Update1 : stats[player.ID].Lastkill instead of lastkill
Title: Re: Can it be possible
Post by: MacTavish on Sep 14, 2015, 11:21 AM
Caution: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
}
}
Title: Re: Can it be possible
Post by: KAKAN on Sep 14, 2015, 05:16 PM
Hehe, 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
Title: Re: Can it be possible
Post by: . on Sep 14, 2015, 05:31 PM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fwww.quickmeme.com%2Fimg%2F7a%2F7a0184f91b92b0ed95d4f2569e297dda4202c180f1190aebcad34157e5c9de60.jpg&hash=6798c814db5e011fe8fc8a0d469b09cab30e63e5)
Title: Re: Can it be possible
Post by: Thijn on Sep 14, 2015, 05:59 PM
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.
Title: Re: Can it be possible
Post by: KAKAN on Sep 14, 2015, 06:04 PM
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?
Title: Re: Can it be possible
Post by: Thijn on Sep 14, 2015, 06:07 PM
Here: http://squirrel-lang.org/doc/sqstdlib3.html
Title: Re: Can it be possible
Post by: 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
Title: Re: Can it be possible
Post by: KAKAN on Sep 15, 2015, 09:36 AM
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
Title: Re: Can it be possible
Post by: MacTavish on Sep 15, 2015, 09:42 AM
@Thijn i already mention that was an untested idea
Title: Re: Can it be possible
Post by: Debian on Sep 15, 2015, 11:15 AM
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?
Title: Re: Can it be possible
Post by: KAKAN on Sep 15, 2015, 01:00 PM
He just can't understand what u meant
Title: Re: Can it be possible
Post by: Debian on Sep 15, 2015, 02:30 PM
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