Raised This Month: $95 Target: $400
 23% 

Kills race


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
qwertynogood
New Member
Join Date: Dec 2019
Old 12-26-2019 , 02:52   Kills race
Reply With Quote #1

I found this plugin which is like a frag race to 50 kills.
is it possible to start the race only after there are 5 players on the server?
Thank you
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>

#define PLUGIN "Frag Limit"
#define VERSION "1.0"
#define AUTHOR "Sh!nE*"

#define MAX_PLAYERS 32

new bool:g_restart_attempt[MAX_PLAYERS + 1]
new fraglimit_on, fraglimit
new bool:winnerfound=false

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	fraglimit_on = register_cvar("fl_on","1")
	fraglimit = register_cvar("fl_fraglimit","50")
	
	register_event("DeathMsg","death_a","a")
	
	register_event("ResetHUD", "event_hud_reset", "be")
	register_clcmd("fullupdate", "clcmd_fullupdate") 
	register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in")
}

public clcmd_fullupdate() {
	return PLUGIN_HANDLED_MAIN
}

public event_restart_attempt() {
	new players[32], num
	get_players(players, num, "a")
	for (new i; i < num; ++i)
		g_restart_attempt[players[i]] = true
}

public event_hud_reset(id) {
	if (g_restart_attempt[id]) {
		g_restart_attempt[id] = false
		return
	}
	event_player_spawn(id)
}

public event_player_spawn(id)
{
	ShowFragsLeft(id)
}

public death_a()
{    
	if(!get_pcvar_num(fraglimit_on) || winnerfound)
		return PLUGIN_HANDLED
	
	new players[32], num
	get_players(players, num)
	new Frags
	
	new killer=read_data(1)
	new victim=read_data(2)
	
	for (new i=0; i<num; i++)
	{
		Frags = get_user_frags(players[i])
		
		if(Frags >= get_pcvar_num(fraglimit))
		{
			set_hudmessage(0, 255, 255, -1.0, 0.0, 0, 1.0, 7.0, 0.1, 0.2)
			show_hudmessage(0, "%s Won the match!!!", killer)
			set_dhudmessage(0, 255, 255, -1.0, -1.0, 0, 2.0, 3.0, 0.8, 0.8)
			show_hudmessage(0, "And the last frag was %s", victim)
			
			winnerfound=true
			set_task(5.0,"set_timelimit")
			break
		}    
	}
	return PLUGIN_CONTINUE
}

public set_timelimit()
{
	new Float:time=halflife_time() + 60.0 ; set_cvar_num("mp_timelimit",floatround(time/60))
	set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 6.0, 5.0)
	show_hudmessage(0, "Map change after 1 minute")
}

public ShowFragsLeft(id)
{    
	new Frags = get_user_frags(id)
	new Frags_left = get_pcvar_num(fraglimit) - Frags
	
	set_dhudmessage(0, 255, 255, -1.0, -1.0, 0, 2.0, 3.0, 0.8, 0.8)
	show_hudmessage(id, "%d Frags Remaining", Frags_left)
	
	set_task(1.0,"ShowFragsLeft", id)
}
qwertynogood is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:38.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode