SubPlugin and bounty restrictions (RankSystem OciXCrom)

Ако имате затруднения при изработката/преработката на даден плъгин - пишете тук, ще се опитаме да ви помогнем!
Аватар
mar1anx
Извън линия
Foreigner
Foreigner
Мнения: 41
Регистриран на: 17 Сеп 2018, 00:56
Се отблагодари: 4 пъти
Получена благодарност: 2 пъти

SubPlugin and bounty restrictions (RankSystem OciXCrom)

Мнение от mar1anx » 12 Апр 2021, 17:11

hello, I need to make this plugin run only from x online players (spec bot restriction not to calculate them), with cvar for set minimum players to start plugins

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <crxranks>
#include <fun>
#include <hamsandwich>

public plugin_init()
{
    register_plugin("CRXRanks: Weapon Example", "1.0", "OciXCrom")
    RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
}

public OnPlayerSpawn(id)
{
    if(!is_user_alive(id))
        return

    if(crxranks_get_user_level(id) >= 10)
        give_item(id, "weapon_hegrenade")
}

Код за потвърждение: Избери целия код

 // AMX Mod X Script
 //
 // bountyhunter.amxx
 //
 // Author Slurpy [COF]
 // [email protected]
 //
 //  USAGE: (cvars for amxx.cfg)
 //  ======
 //  amx_bountyhunter <1/0>        = enable/disable bounty hunter
 //
 //  killraisesbounty <amount>   = bonus added to bounty for every kill the mark makes during round
 //
 //  basebounty <amount>   = number of frags for mark times this amount for the base bounty
 //
 //  tkmarkpenalty <amount>   = $ penalty for tking the mark
 //
 //  DESCRIPTION:
 //  ============
 //  This plugin will randomly  select one person each round to be the mark.
 //  The player "bounty hunter" that kills the mark gets a monetary bonus based
 //  on the number of kills that the mark has and any additional ones made during that round.
 //  If the mark is not killed, the money is gone and a new mark with a new bounty is selected the next round.
 //
 // CHANGELOG:
 // ==========
 //
 // - 01.09.2005 Version 1.0
 //   * Initial public Release
 //
 //  TO POSSIBLY BE ADDED
 //  ====================
 //  - make the mark glow 
 //  - give the mark free armour
 //  - ability for players to add to the bounty
 //

 // Uncomment for debug amxx log messages
 //#define DEBUG_LOGGING

 #include <amxmodx>
 #include <amxmisc>
 #include <cstrike>

 //globals
 new g_bounty = 0
 new g_mark //id of the hunted
 new g_marks_name[32]


 public plugin_init() {
	register_plugin("Bounty Hunter","1.0","Slurpy [COF]")
	register_cvar("amx_bountyhunter","1")
	register_cvar("killraisesbounty", "300")
	register_cvar("basebounty", "150")
	register_cvar("tkmarkpenalty", "2000")
	register_event("DeathMsg", "death_event", "a")
	register_logevent("new_round",2,"0=World triggered","1=Round_Start")
 }

 public new_round() {
	if(get_cvar_num("amx_bountyhunter") != 0){
		new players[32], numplayers
		get_players( players, numplayers, "a" )
		g_mark = players[ random_num(0, numplayers-1) ]
		new frags = get_user_frags(g_mark)
		new basebounty = get_cvar_num("basebounty")
		g_bounty = get_bounty(frags,basebounty)
		#if defined DEBUG_LOGGING
		log_amx( "get_bounty returns %d", g_bounty)
		#endif
		if (g_bounty < basebounty){
			g_bounty = basebounty
			#if defined DEBUG_LOGGING
			log_amx( "g_bounty less than basebounty, changed g_bounty to %d", g_bounty)
			#endif
		}
		set_task(2.0,"show_mark")
	}
	return PLUGIN_CONTINUE
 }

 public death_event() {
	if(get_cvar_num("amx_bountyhunter") != 0){
		new victim = read_data(2)
		new killer = read_data(1)
		if (victim == g_mark){
			if (victim == killer){  //mark kills themself
				new suicide_mark[32]
				get_user_name(killer,suicide_mark,31)
				set_hudmessage(255, 0, 0, 0.5, 0.5, 0, 3.0, 5.0, 0.1, 0.2, 2)
				show_hudmessage(0, "%s tried to collect the bounty on themself",suicide_mark)
				return PLUGIN_CONTINUE
				}else if(get_user_team(victim) == get_user_team(killer)){//team kill gets penalized
				new tk_mark_penalty = get_cvar_num("tkmarkpenalty")
				new losemoney = cs_get_user_money(killer) - tk_mark_penalty
				if (losemoney > 0){
					cs_set_user_money(killer, losemoney, 1)
					}else{
					cs_set_user_money(killer, 0, 1)
				}
				new tk_killer[32]
				get_user_name(victim,tk_killer,31)
				set_hudmessage(255, 0, 0, 0.5, 0.5, 0, 3.0, 5.0, 0.1, 0.2, 2)
				show_hudmessage(0, "%s lost %d for tking the mark",tk_killer, tk_mark_penalty)
				return PLUGIN_CONTINUE
				}else{ //Pay the bounty hunter
				new newmoney = cs_get_user_money(killer) + g_bounty
				cs_set_user_money(killer, newmoney, 1)
				new killer_name[32]
				get_user_name(killer,killer_name,31)
				set_hudmessage(255, 0, 0, 0.33, 0.66, 0, 3.0, 5.0, 0.1, 0.2, 2)
				show_hudmessage(0, "%s collected a %d bounty for killing %s",killer_name, g_bounty, g_marks_name)
				#if defined DEBUG_LOGGING
				log_amx("[BountyHunter] %s collected a %d bounty for killing %s",killer_name, g_bounty, g_marks_name)
				#endif
				g_bounty = 0
			}
			return PLUGIN_CONTINUE
			}else if (killer == g_mark){ //Add some more to the bounty
			new raisebounty = get_cvar_num("killraisesbounty")
			g_bounty = get_raise_bounty(g_bounty,raisebounty)
			set_hudmessage(255, 0, 0, 0.33, 0.6, 0, 3.0, 5.0, 0.1, 0.2, 2)
			show_hudmessage(0, "The Bounty on %s is now %d", g_marks_name,g_bounty)
			#if defined DEBUG_LOGGING
			log_amx("The Bounty on %s is now %d", g_marks_name,g_bounty)
			#endif
			}else{
			return PLUGIN_CONTINUE
		}
	}
	return PLUGIN_CONTINUE
 }

 public show_mark(){
	get_user_name(g_mark, g_marks_name, 31)
	set_hudmessage(255, 0, 0, 0.33, 0.6, 0, 3.0, 5.0, 0.1, 0.2, 2)
	show_hudmessage(0, "There is a %d bounty on %s", g_bounty, g_marks_name)
	#if defined DEBUG_LOGGING
	log_amx( "There is a %d bounty on %s", g_bounty, g_marks_name)
	#endif
 }

 get_bounty(first, second)//initial bounty calculation
 {
	new sum = (first * second)
	return sum
 }

 get_raise_bounty(first, second)//add to bounty for mark getting a kill
 {
	new sum2 = (first + second)
	return sum2
 }


  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Помощ в скриптирането”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 7 госта