// ******************************
// Mattie's MugMod v0.61
//      for Counter-Strike: Source
//
// * Description:
//      Any knife kill will steal all of the victim's money. 
//
//
// * Install instructions:
//       1. Install Mattie's EventScripts plugins:
//            http://mattie.info/cs
//
//       2. Copy all of this script into a new textfile:
//           cstrike/addons/eventscripts/mugmod/es_mugmod.txt
//
//       3. Add the following line somewhere in autoexec.cfg:
//           es_load mugmod
//
//       4. (Optional) Review the config settings below and tweak
//
// ******************************


block config
{

// ******************************
//   MUGMOD SETTINGS 
// ******************************
	// enable
	mattie_mugmod 1

	// enables round-start announcement
	mugmod_announce 1

	// enables kill sound
	mugmod_sounds 1
	mugmod_soundfile "bot/owned.wav"


// ******************************
//   MUGMOD SAYINGS
// ******************************
	// Feel free to change the sayings but be sure
	//    to increase the number_of_sayings if you add or remove 
	es_keysetvalue mugmod sayings number_of_sayings 5

	es_keysetvalue mugmod sayings 1 "[MUGGING] Your money or your life. Well, I guess I'll take both."
	es_keysetvalue mugmod sayings 2 "[MUGGING] So I guess he's not going to be needing this wallet."
	es_keysetvalue mugmod sayings 3 "[MUGGING] They say you can't take it with you."
	es_keysetvalue mugmod sayings 4 "[MUGGING] Next time cough up the lunch money, loser."
	es_keysetvalue mugmod sayings 5 "[MUGGING] CHA-CHING!"

	  // used when a victim is poor
	es_keysetvalue mugmod sayings nomoney "[MUGGING] JUST GREAT. All that work and nothing to show for it."

	  // used for a knife teamkill
	es_keysetvalue mugmod sayings teamknifer "[MUG ATTEMPT] *** I'm a team back-stabber! ***"
}


//
//
// ONLY ADVANCED USERS BELOW THIS LINE
// ***********************************


event load
{
	es_log Loading MugMod...

	// called whenever the plugin is loaded
	es_setinfo mattie_mugmod 0 
	es_makepublic mattie_mugmod
	es_setinfo mugmod_sounds 0
	es_setinfo mugmod_announce 0
	es_setinfo mugmod_soundfile 0

	es_keygroupdelete mugmod
	es_keygroupcreate mugmod
	es_keycreate mugmod sayings
	// import the user's configs
	es_doblock mugmod/config	

}

event round_start
{
	if (server_var(mattie_mugmod) > 0) do
	{
		// do the announcement
		if (server_var(mugmod_announce) > 0) then es_xmsg #multi #green[MugMod]#default Mugging is in effect. Take a player's money by killing them with a knife.
	}
}

event player_death
{
	if (server_var(mattie_mugmod) > 0) do
	{
		if (event_var(weapon) equalto knife) do
		{
			es_xsetinfo randsay 0
			// don't mug if they're on the same team.
			if (event_var(es_attackerteam) notequalto event_var(es_userteam)) do
			{
				// take money
				es_xsetinfo killercash 0
				es_xsetinfo victimcash 0
				es_getplayerprop killercash event_var(attacker) "CCSPlayer.m_iAccount"
				es_getplayerprop victimcash event_var(userid) "CCSPlayer.m_iAccount"
				es_math killercash + server_var(victimcash)
				es_setplayerprop event_var(attacker) "CCSPlayer.m_iAccount" server_var(killercash)
				es_setplayerprop event_var(userid) "CCSPlayer.m_iAccount" 0
				
				// play sound
				if (server_var(mugmod_sounds) > 0) then es_xcexec_all playgamesound server_var(mugmod_soundfile)
				
				// say message
				if (server_var(victimcash) <= 200) do
				{
					// poor victim
					es_xkeygetvalue randsay mugmod sayings nomoney
					es_cexec event_var(attacker) say server_var(randsay)
				}
				else
				{
					// rich victim
					es_xkeygetvalue randsay mugmod sayings number_of_sayings
					es_xrand randsay 1 server_var(randsay)
					es_keygetvalue randsay mugmod sayings server_var(randsay)
					es_cexec event_var(attacker) say server_var(randsay)
				}
			}
			else
			{
				es_xkeygetvalue randsay mugmod sayings teamknifer
				es_cexec event_var(attacker) say server_var(randsay)
			}
		}
	}
}


// ******************************
//   END MUGMOD SCRIPT
// ******************************

