Jump to content
Sign in to follow this  
acme

TOP 5 [top-player]

Recommended Posts

Skripts parkodets un velos padalities ar parejiem biedriem kas izmanto vel cs 1.6.

Ja nodereja liec like

#include < amxmodx >
#include < fun >

#define MAX_ARM 400
#define MAX_HLT 255

new gMESSAGE[256]
new gMAXPLAYERS, gSAYTEXT

native get_user_stats(index, stats[8], bodyhits[8])


public plugin_init()
{
	register_plugin("TOP FIVE BONUS", "0.1", "privat")
	register_logevent("round_start", 2, "0=World triggered", "1=Round_Start")
	register_clcmd("say_team", "hook_sayteam")
	register_clcmd("say", "hook_say")
	gSAYTEXT = get_user_msgid("SayText")
 	gMAXPLAYERS = get_maxplayers()
}

public round_start()
{
	for(new i; i <= gMAXPLAYERS; i++)
	{
		if(is_user_hltv(i) || is_user_bot(i) || !is_user_connected(i))
			continue

		new stats[8], bodyhits[8]
		new pARM = get_user_armor(i)
		new pHEAL = get_user_health(i)
		new pTOP = get_user_stats(i, stats, bodyhits)

		if(pTOP == 1)
		{
			if(pARM < MAX_ARM)
				set_user_armor(i, pARM + 20)
			else
				set_user_armor(i, MAX_ARM)
			if(pARM < MAX_HLT)
				set_user_health(i, pHEAL + 20)
			else
				set_user_health(i, MAX_HLT)
		
			client_print(i, print_chat, "[Top-bonus] Tu ienem %d vietu ranka, tavs bonus: +20 hp, +20 armor - veiksmigi ieguts.", pTOP)
		}
		if(pTOP == 2)
		{
			if(pARM < MAX_ARM)
				set_user_armor(i, pARM + 15)
			else
				set_user_armor(i, MAX_ARM)
			if(pARM < MAX_HLT)
				set_user_health(i, pHEAL + 15)
			else
				set_user_health(i, MAX_HLT)
		
			client_print(i, print_chat, "[Top-bonus] Tu ienem %d vietu ranka, tavs bonus: +15 hp, +15 armor - veiksmigi ieguts.", pTOP)
		}
		if(pTOP == 3)
		{
			if(pARM < MAX_ARM)
				set_user_armor(i, pARM + 10)
			else
				set_user_armor(i, MAX_ARM)
			if(pARM < MAX_HLT)
				set_user_health(i, pHEAL + 10)
			else
				set_user_health(i, MAX_HLT)
	
			client_print(i, print_chat, "[Top-bonus] Tu ienem %d vietu ranka, tavs bonus: +10 hp, +10 armor - veiksmigi ieguts.", pTOP)
		}
		if(pTOP == 4 || pTOP == 5)
		{
			if(pARM < MAX_ARM)
				set_user_armor(i, pARM + 5)
			else
				set_user_armor(i, MAX_ARM)
			if(pARM < MAX_HLT)
				set_user_health(i, pHEAL + 5)
			else
				set_user_health(i, MAX_HLT)
	
			client_print(i, print_chat, "[Top-bonus] Tu ienem %d vietu ranka, tavs bonus: +5 hp, +5 armor - veiksmigi ieguts.", pTOP)
		}
	}
}

public hook_say(pID)
{
	if(is_user_hltv(pID) || is_user_bot(pID) || !is_user_connected(pID))
		return PLUGIN_CONTINUE

	new gMSG[192], iLEN
	read_args(gMSG, charsmax(gMSG))
	remove_quotes(gMSG)
	
	if(is_empty_message(gMSG))
		return PLUGIN_HANDLED

	if(is_slash(gMSG))
		return PLUGIN_HANDLED_MAIN
		
	new stats[8], bodyhits[8], gNAME[32], pTOP
	pTOP = get_user_stats(pID, stats, bodyhits)
	get_user_name(pID, gNAME, charsmax(gNAME))

	if(1 <= pTOP <= 5)
	{
		iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s[^4Top-Player^1] ", is_user_alive(pID) ? "" : "*Dead* ")
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^3%s ^1: ", gNAME)
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^4%s", gMSG)
	} else
	{
		iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s", is_user_alive(pID) ? "" : "*Dead* ")
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^3%s ^1: ", gNAME)
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "%s", gMSG)
	}
	
	for(new i = 1; i <= gMAXPLAYERS; i++)
	{
		if(!is_user_connected(i))
			continue

		write_msg(gMESSAGE, pID, i)
	}
	return PLUGIN_HANDLED
}

public hook_sayteam(pID)
{
	if(is_user_hltv(pID) || is_user_bot(pID) || !is_user_connected(pID))
		return PLUGIN_CONTINUE

	new gMSG[192], iLEN
	read_args(gMSG, charsmax(gMSG))
	remove_quotes(gMSG)
	
	if(is_empty_message(gMSG))
		return PLUGIN_HANDLED

	if(is_slash(gMSG))
		return PLUGIN_HANDLED_MAIN

	new stats[8], bodyhits[8], gNAME[32], pTOP
	pTOP = get_user_stats(pID, stats, bodyhits)
	get_user_name(pID, gNAME, charsmax(gNAME))

	if(1 <= pTOP <= 5)
	{
		if(get_user_team(pID) == 1) iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s(Ts) [^4Top-Player^1] ", is_user_alive(pID) ? "" : "*Dead* ")
		else if(get_user_team(pID) == 2) iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s(Ct) [^4Top-Player^1] ", is_user_alive(pID) ? "" : "*Dead* ")
		else if(get_user_team(pID) == 3) iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s(Spec) [^4Top-Player^1] ", is_user_alive(pID) ? "" : "**Dead* ")
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^3%s ^1: ", gNAME)
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^4%s", gMSG)
	} else
	{
		if(get_user_team(pID) == 1) iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s(Ts) ", is_user_alive(pID) ? "" : "*Dead* ")
		else if(get_user_team(pID) == 2) iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s(Ct) ", is_user_alive(pID) ? "" : "*Dead* ")
		else if(get_user_team(pID) == 3) iLEN = format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^1%s(Spec) ", is_user_alive(pID) ? "" : "*Dead* ")
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "^3%s ^1: ", gNAME)
		iLEN += format(gMESSAGE[iLEN], charsmax(gMESSAGE) - 1, "%s", gMSG)
	}
	
	for(new i = 1; i <= gMAXPLAYERS; i++)
	{
		if(!is_user_connected(i))
			continue

		if(get_user_team(pID) == get_user_team(i))
			write_msg(gMESSAGE, pID, i)
	}
	return PLUGIN_HANDLED
}

stock is_slash(const message[])
{
	if(message[0] == '/')
		return true
	return false
}

stock is_empty_message(const message[])
{
	if(equal(message, "") || !strlen(message))
		return true
	return false
}

stock write_msg(const message[], const pID, const i)
{
	message_begin(MSG_ONE, gSAYTEXT, {0, 0, 0}, i)
	write_byte(pID)
	write_string(message)
	message_end()
}

[Click and drag to move]

 

Edited by acme
  • Upvote 1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×