Vice City: Multiplayer

Server Development => Scripting and Server Management => Snippet Showroom => Topic started by: Finch Real on May 27, 2016, 05:07 PM

Title: Happy Killing Minute
Post by: Finch Real on May 27, 2016, 05:07 PM
Hello folks, since I'm tired to Create Happy Kill Minute and finally its Finish. I've tested it quite well and it seems alright to me.

Now for the stuff you have to manage and learn:

Add This on Functions.nut

function loadhappykill()
{
print("Happy One Minute Loaded!");
NewTimer( "killers", 30000, 1);
}
function random(start, finish)
{
   local t;
   if (start < 0) t = ((rand() % (-start + finish)) + start)
   else
   {
      t = ((rand() % (finish - start)) + start);
   }
   return t;
}

function kills()
{
killcash <- 0;
}
function killers()
{
ClientMessageToAll( ">Happy one minute started, Kill Anyone and Get Random Cash.",255,255,0);
 print("Killing Has Been Started");
NewTimer( "killeds", 60000, 1);
killcash=1;
}
function killeds()
{
if ( killcash == 1)
{
ClientMessageToAll( "Happy Kill Minute is Over",255,255,0);
 print("Killing is Over");
killcash=0;
NewTimer( "killers", 120000, 1);
}
}

Add  This Stuff to Main.nut

function onScriptLoad()
{
RandomCash <- array( GetMaxPlayers(), 1 );
kills();
loadhappykill();
}

This onPlayerKill Event
function onPlayerKill( killer, player, weapon, bodypart )
{
if ( killcash == 1)
                                                                                {
  local reward = random(4000,400000);
                                          local kill=   RandomCash[killer.ID]*reward;
  ClientMessageToAll( "> " +killer.Name+ " Has Won The Happy One Minute By Killing " + player.Name + " And Got "+kill+".",255,255,0);
               killer.Cash += kill;
                                                                                killeds();
                                                                                  }
}


Have fun, if you find any issues contact me.

~ Regards,
~ Finch!

Updated Again
Title: Re: Happy Killing Minute
Post by: Cool on May 27, 2016, 05:21 PM
i test it on empty script and its doesent giving me money in happy minute
Title: Re: Happy Killing Minute
Post by: Anik on May 27, 2016, 05:40 PM
local kill=   RandomCash[killer.ID]*reward Finch you didn't create any array name RandomCash then why used this??? @Hercules maybe that's the problem.... I maybe wrong as I am from mobile and I didn't test the code.
Title: Re: Happy Killing Minute
Post by: Finch Real on May 27, 2016, 05:43 PM
My Bad! First Post Updated!
Title: Re: Happy Killing Minute
Post by: KAKAN on May 27, 2016, 06:23 PM
if ( killcash == 1)
                                                                                {
Can't you use a better editor like Sublime Text? If no, then use Notepad++ or Atom. I'll prefer Atom.
Title: Re: Happy Killing Minute
Post by: Cool on May 27, 2016, 10:04 PM
still not working finch check it on empty script and fix it if you cant delete it
i know the solution but try to fix it yourself
Title: Re: Happy Killing Minute
Post by: Murdock on May 27, 2016, 11:43 PM
Maybe explain what the hell a Happy Killing Minute is supposed to be
Title: Re: Happy Killing Minute
Post by: KAKAN on May 28, 2016, 03:39 AM
Quote from: Murdock on May 27, 2016, 11:43 PMMaybe explain what the hell a Happy Killing Minute is supposed to be
Snip 1, Line 12:-
ClientMessageToAll( ">Happy one minute started, Kill Anyone and Get Random Cash.",255,255,0);:P
Kill someone and get cash, just like the system of a normal DM server :D
Title: Re: Happy Killing Minute
Post by: Finch Real on May 28, 2016, 03:49 AM
Well @KAKAN I use Notepad++ and @Hercules can you tell us what error is showing?
Title: Re: Happy Killing Minute
Post by: KAKAN on May 28, 2016, 04:37 AM
Quote from: Finch Real on May 28, 2016, 03:49 AMWell @KAKAN I use Notepad++ and @Hercules can you tell us what error is showing?
Can't you test it before releasing?
Test it on a blank script. That script looks so shit that I don't even want to test it :P
Title: Re: Happy Killing Minute
Post by: Finch Real on May 28, 2016, 06:12 AM
First Post Updated @KAKAN Neither i Post Some Shit for you It for Newbies ( Not for Noobs ) who just Insult Instead of Creating Snippet