Resolved (ReAPI) AntiFlashLightSpam + ResetScore

Coding Help/Re-API Supported
User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

(ReAPI) AntiFlashLightSpam + ResetScore

#1

Post by ArminC » 1 Year Ago

1. Can you make this plugin with <reapi>, optimized?

Code: Select all

#include <amxmodx>
#include <engine>

new pcvar_reload_flashlight
new Float:BlockTime[33];

public plugin_init()
{
	register_plugin("Anti FlashLight Spam", "1.2a", "Leo_[BH]")
	
	pcvar_reload_flashlight = register_cvar("flashlight_reload", "1.5")
	
	register_impulse(100, "FlashLight")
}

public FlashLight(id)
{
	new Float:gametime = get_gametime()
	
	if(BlockTime[id] <= gametime)
	{
		BlockTime[id] = gametime + get_pcvar_float(pcvar_reload_flashlight)
		return PLUGIN_CONTINUE;
	}
	
	return PLUGIN_HANDLED;
}

public client_disconnected(id)
{ 
	BlockTime[id] = 0.0; 
}
-- I did found this: (Can be optimized more than now?)

Code: Select all

#include <amxmodx>
#include <reapi>

new pcvar_reload_flashlight
new Float:BlockTime[33];

public plugin_init()
{
	register_plugin("AntiSpam FlashLight", "1.3", "Leo_[BH]")
	
	pcvar_reload_flashlight = register_cvar("flashlight_reload", "1.5")
	
	RegisterHookChain(GamedllFunc_CBasePlayer:RG_CBasePlayer_ImpulseCommands, "RG_ImpulseCommand", 0);
}

public RG_ImpulseCommand(id)
{
	if(get_entvar(id, var_impulse) != 100) return 0
	
	new Float:gametime = get_gametime()

	if(BlockTime[id] <= gametime)
	{
		BlockTime[id] = gametime + get_pcvar_float(pcvar_reload_flashlight)
		return 0
	}
	
	return 1
}

public client_disconnect(id)
{ 
	BlockTime[id] = 0.0; 
}
2. Can you fix (+optimize) this resetscore, or recommend me one better? "1) The score isn't updated in the score board when a player uses /rs when he is alive. He needs to wait one round 2) If he uses /rs when alive and then kills someone/dies his kills/deaths remain the same. Can you fix this?" @An User message

Code: Select all

#include <amxmodx>
#include <reapi>

#define PLUGIN 	"resetscore(ReAPI)"
#define VERSION "1.0"
#define AUTHOR  "Phantom"

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd("say /rs", "resetscore"); register_clcmd("say_team /rs", "resetscore");
}

public resetscore(id) {
	if(!is_user_connected(id)) return;

	set_entvar(id, var_frags, 0.0);
	set_member(id, m_iDeaths, 0);

	message_begin(MSG_ONE_UNRELIABLE, 76, .player = id);
	write_byte(id);
	write_string("^1Счет обнулен");
	message_end();

	message_begin(MSG_ALL, 85);
	write_byte(id);
	write_short(0); write_short(0); write_short(0); write_short(0);
	message_end();
}
+ Add a sound after reset
+ Make a 30 seconds? wait time
+ A message just for user that he did reset the score (I see that's already.. but a more nicer.. with colors and tag.. and more..)

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#2

Post by Raheem » 1 Year Ago

1. No more optimization can be done in this AntiFlashLightSpam plugin. Just if you need use client_disconnected() instead of client_disconnect(). client_disconnected() in AMXMODX v 1.8.3-dev.

2. For resetting score using ReAPI use my plugin: viewforum.php?f=15
  • Sound is simple you can add any if needed.
    About delay i see it's useless as this related to player and it never flood the server.
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#3

Post by ArminC » 1 Year Ago

Yeah I saw it but.. is for ZE..

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 624
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#4

Post by Mohamed Alaa » 1 Year Ago

You don't need this part "GamedllFunc_CBasePlayer:".
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#5

Post by Raheem » 1 Year Ago

ArminC wrote:
1 Year Ago
Yeah I saw it but.. is for ZE..
Yes for sure as we only a community for ZE. Any general support maybe private so if you so interested you to do these things you can contact me on telegram (I'm there 24/7). My telegram: https://t.me/RaheemElsayed
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#6

Post by ArminC » 1 Year Ago

I don't have Telegram oh..

Question: what's the difference betwen:

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()

and
message_begin(MSG_BROADCAST, 85);
write_byte(id);
write_short(0);
write_short(0);
write_short(0);
write_short(0);
message_end();

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#7

Post by ArminC » 1 Year Ago

PS: Something to fix, all good :D ? #For moment it doesn't work .. because client_cmd is already defined??

Code: Select all

#include <amxmodx>
#include <reapi>

#define HIDE_CHAT_MSG 	// Hide the chat message when the player writes "/rs"
#define INFO_TEXT 		// Show the notification to the player in the chat when the account is reset
#define SOUND           // Play a sound after reset
#define RS_CHAT_MSG "^4[ZPNM] ^3Your account has been reseted!" 		// Message text for zeroing the account
 
public plugin_init()
{
	register_plugin("ResetScore", "1.1", "Leo_[BH], ArminC");

	register_clcmd("say /rs", "reset_score");
	register_clcmd("say_team /rs", "reset_score");
	register_clcmd("say /resetscore", "reset_score");
	register_clcmd("say_team /resetscore", "reset_score");

}

public reset_score(id)
{
	if(!is_user_connected(id)) return PLUGIN_CONTINUE;
	{
		set_entvar(id, var_frags, 0.0);
		set_member(id, m_iDeaths, 0);
	
		message_begin(MSG_BROADCAST, 85);
		write_byte(id);
		write_short(0); 
		write_short(0); 
		write_short(0); 
		write_short(0);
		message_end();
	}
	return PLUGIN_CONTINUE
}

#if defined INFO_TEXT
public text_reset_score(id)
ChatColorOne(id, RS_CHAT_MSG);

stock ChatColorOne(const id, const szMessage[], any:...)
{
	static szMsg[191], IdMsg; 
	vformat(szMsg, charsmax(szMsg), szMessage, 3);
	if(!IdMsg) IdMsg = get_user_msgid("SayText");
	if(!is_user_connected(id)) return 0;	
	message_begin(MSG_ONE_UNRELIABLE, IdMsg, .player = id);
	write_byte(id);
	write_string(szMsg);
	message_end();
	return 1;
}
#endif

#if defined SOUND
client_cmd(id, spk "cleanup(t20) progress(t20)");
#endif

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#8

Post by ArminC » 1 Year Ago

up?

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#9

Post by Raheem » 1 Year Ago

Rest Score ReAPI version for normal Mods: Make sure to use AMXMODX v 1.8.3 for client_print_color() function.
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#10

Post by ArminC » 1 Year Ago

Thanks now the last 3 problems in order to escape from this plugin ^_^

- To stay without dictionary.. really :)) --> client_print_color(id, print_team_default, "^3Your score has been reset successfully^1", "RESET_SCORE") ??
* How I can add diffrent colored Tag than the rest of the text?

- For speak --> client_cmd(id, spk "cleanup(t20) progress(t20)"); (under the client_print?)

- Can you add time limit because I don't want that speak to be spammed.. thanks, don't mind on my a lot request :(

- Future edit: can you add more values than /rs? /resetscore /reset or whatever.. :roll:

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests