Reset Score - 2

Coding Help/Re-API Supported
Post Reply
User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

Reset Score - 2

#1

Post by ArminC » 6 years ago

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
}
Last edited by ArminC 6 years ago, edited 6 times in total.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#2

Post by ArminC » 6 years ago

Bump?!

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#3

Post by ArminC » 6 years ago

Edited my request :oops:

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#4

Post by Night Fury » 6 years ago

Edit this message:
"^1[^4RS^1] ^3You don't have minimum %i frags and %i deaths to ^4reset ^3the score^1."
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests