Page 1 of 1

Reset Score - 2

Posted: 07 Feb 2018, 19:11
by ArminC
Instead of MIN Deaths + Frags to allow you to Reset The Score at the next round/spawn :) If the score is 0.. it should say that's already .. reseted..

Code: Select all

#include <amxmodx>
#include <reapi>

#define MIN_FRAGS 3 // Player who has more than minimum frags will be able to reset his score but not lower
#define MIN_DEATHS 1 // Player who has more than minimum deaths will be able to reset his score but not lower

new const resetScoreCommands[][] =
{
	"/rs", "/resetscore", "/rscore", "/resets"
}

new sayCmd[64], sayTeamCmd[64], x

public plugin_init()
{
	register_plugin("Reset Score", "1.2", "Raheem")
	
	// Commands
	for (x = 0; x <= charsmax(resetScoreCommands); x++)
	{
		formatex(sayCmd, charsmax(sayCmd), "say %s", resetScoreCommands[x])
		formatex(sayTeamCmd, charsmax(sayTeamCmd), "say_team %s", resetScoreCommands[x])
		register_clcmd(sayCmd, "CmdSay")
		register_clcmd(sayTeamCmd, "CmdSay")
	}
}

public CmdSay(id)
{
	if (get_entvar(id, var_frags) > MIN_FRAGS || get_member(id, m_iDeaths) > MIN_DEATHS)
	{
		set_entvar(id, var_frags, 0.0)
		set_member(id, m_iDeaths, 0)
		
		message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
		write_byte(id) // id
		write_short(0) // Frags
		write_short(0) // Deaths
		write_short(0) // Class
		write_short(get_member(id, m_iTeam)) // Team
		message_end()
		
		client_print_color(id, print_team_default, "^1[^4RS^1] ^3Your score has been ^4reset^1.")
		client_cmd(id, "spk ^"buttons/bell1^"")
		return PLUGIN_HANDLED
	}
	else
	{
		client_print_color(id, print_team_default, "^1[^4RS^1] ^3You don't have minimum %i frags and %i deaths to ^4reset ^3the score^1.", MIN_FRAGS, MIN_DEATHS)
		client_cmd(id, "spk ^"buttons/button2^"")
	}
	
	return PLUGIN_CONTINUE
}

Re: Reset Score - Part 2

Posted: 26 Feb 2018, 15:33
by ArminC
Bump?!

Re: Reset Score - 2

Posted: 01 Mar 2018, 15:49
by ArminC
Edited my request :oops:

Re: Reset Score - 2

Posted: 25 Mar 2018, 20:59
by Mohamed Alaa
Edit this message:
"^1[^4RS^1] ^3You don't have minimum %i frags and %i deaths to ^4reset ^3the score^1."