Raised This Month: $51 Target: $400
 12% 

Fastspectate plugin help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maNIaRO
Member
Join Date: Nov 2014
Old 04-18-2022 , 09:00   Fastspectate plugin help
Reply With Quote #1

Hi everybody,
I have this fastspectate plugin on my server

Code:
#include <amxmodx>
#include <cstrike>

#include <colorchat>
#include <fun>

#pragma semicolon 1

static const PLUGIN_NAME[] 	= "Fast Spectate";
static const PLUGIN_AUTHOR[] 	= "sPuf ?";
static const PLUGIN_VERSION[]	= "2.0";

new gReturn[33],gDeaths[33],gFrags[33];

new cvar_score,cvar_msg,cvar_spawn;

public plugin_init() {
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
	
	cvar_score = register_cvar("fs_score","1");
	cvar_msg = register_cvar("fs_message","1");
	cvar_spawn = register_cvar("fs_spawn","1");
	
	register_clcmd("say /spec","saySpec");
	register_clcmd("say_team /spec","saySpec");
	
	register_clcmd("say /back","sayBack");
	register_clcmd("say_team /back","sayBack");	
}
public saySpec(id) {
	new team = get_user_team(id);
	switch(team) {
		case 1: {
			gReturn[id] = 1;
		}
		case 2: {
			gReturn[id] = 2;
		}
		case 3: {
			if(get_pcvar_num(cvar_msg)) {	
				ColorChat(id,RED,"[^x04PLOIESTI^x01] You are already spectator!");
			}
			return PLUGIN_HANDLED;
		}
	}
	if(get_pcvar_num(cvar_score) == 1) {	
		gFrags[id] = get_user_frags(id);
		gDeaths[id] = get_user_deaths(id);
	}
	if(is_user_alive(id)) {
		user_silentkill(id);
		cs_set_user_team(id,3);
		if(get_pcvar_num(cvar_msg)) {	
			ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Spectators^x01!");
			ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/back^" ^x01to be transferred in your last team!");
		}
		return PLUGIN_HANDLED;
	} else {
		cs_set_user_team(id,3);
		if(get_pcvar_num(cvar_msg)) {	
			ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Spectators^x01!");
			ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/back^" ^x01to be transferred in your last team!");
		}
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}
public sayBack(id) {
	if(!(get_user_team(id) == 3) || is_user_alive(id)) {
		if(get_pcvar_num(cvar_msg)) {	
			ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You can use this command only after you typed ^x04/spec^x01 If you want to join a team, type in console ^x04jointeam");
			ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/spec^" ^x01to be transferred on ^x03Spectators^x01!");
			return PLUGIN_HANDLED;
		}
	} else {
		switch(gReturn[id]) {
			case 1: {
				cs_set_user_team(id,1);
				if(get_pcvar_num(cvar_msg)) {
					ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Terrorist^x01!");
					ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/spec^" ^x01to be transferred to ^x03Spectators^x01!");
				}
				if(get_pcvar_num(cvar_score)) {	
					cs_set_user_deaths(id, gDeaths[id]);
					set_user_frags(id, gFrags[id]);
					cs_set_user_deaths(id, gDeaths[id]);
					set_user_frags(id, gFrags[id]);
					ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Your score is ^x04%d^x01-^x04%d ^x01!",gFrags[id],gDeaths[id]);
				}
				if(get_pcvar_num(cvar_spawn)) {
					spawn(id);
				}
				return PLUGIN_HANDLED;
			}
			case 2: {
				cs_set_user_team(id,2);
				if(get_pcvar_num(cvar_msg)) {
					ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] You have been transferred to ^x03Counter-Terrorist^x01!");
					ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Type in chat ^x04^"/spec^" ^x01to be transferred to ^x03Spectators^x01!");
				}
				if(get_pcvar_num(cvar_score)) {	
					cs_set_user_deaths(id, gDeaths[id]);
					set_user_frags(id, gFrags[id]);
					cs_set_user_deaths(id, gDeaths[id]);
					set_user_frags(id, gFrags[id]);
					ColorChat(id,RED,"^x01[^x04PLOIESTI^x01] Your score is ^x04%d^x01-^x04%d ^x01!",gFrags[id],gDeaths[id]);
				}
				if(get_pcvar_num(cvar_spawn)) {
					spawn(id);
				}
				return PLUGIN_HANDLED;
			}
		}
	}
	return PLUGIN_CONTINUE;
}
public client_putinserver(id) {
	gDeaths[id] = 0;
	gFrags[id] = 0;
	gReturn[id] = 0;
}
public client_disconnect(id) {
	gDeaths[id] = 0;
	gFrags[id] = 0;
	gReturn[id] = 0;
}
Seems that some of my players/admins are quite smart in finding bugs or "cheating" the system
If one player dies in battle he types in chat /spec and then /back and respawn nice and easy quite alive.

Can I get help from some of you please, to make it when they type /back, to be dead, not alive?
Or any other idea to fix this issue?

Thanks

Last edited by maNIaRO; 04-18-2022 at 09:01.
maNIaRO is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-18-2022 , 10:09   Re: Fastspectate plugin help
Reply With Quote #2

register_clcmd("say /back","sayBack");
register_clcmd("say_team /back","sayBack");

>>

//register_clcmd("say /back","sayBack");
//register_clcmd("say_team /back","sayBack");
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
zXCaptainXz
Member
Join Date: May 2017
Old 04-18-2022 , 10:27   Re: Fastspectate plugin help
Reply With Quote #3

Disable the cvar fs_spawn, add this to amxx.cfg

fs_spawn 0
zXCaptainXz is offline
maNIaRO
Member
Join Date: Nov 2014
Old 04-18-2022 , 18:11   Re: Fastspectate plugin help
Reply With Quote #4

Quote:
Originally Posted by JocAnis View Post
register_clcmd("say /back","sayBack");
register_clcmd("say_team /back","sayBack");

>>

//register_clcmd("say /back","sayBack");
//register_clcmd("say_team /back","sayBack");
Yeah, small advice: don't speak if you don't bring any value with those words. Same with your reply.

Quote:
Originally Posted by zXCaptainXz View Post
Disable the cvar fs_spawn, add this to amxx.cfg

fs_spawn 0
Thanks zXCaptainXz, problem solved.
maNIaRO is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-19-2022 , 18:41   Re: Fastspectate plugin help
Reply With Quote #5

Quote:
Originally Posted by maNIaRO View Post
Yeah, small advice: don't speak if you don't bring any value with those words. Same with your reply.
you wanted to disable say /back command, and i posted it for you...no need to act smart when someone tries to help you
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
maNIaRO
Member
Join Date: Nov 2014
Old 04-19-2022 , 18:48   Re: Fastspectate plugin help
Reply With Quote #6

Quote:
Originally Posted by JocAnis View Post
you wanted to disable say /back command, and i posted it for you...no need to act smart when someone tries to help you
If english is too hard for you, I will repeat my message:
"When they type /back to be dead, not alive"
If I say "when they type", for you means I want to disable that command?
maNIaRO is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 04-19-2022 , 23:15   Re: Fastspectate plugin help
Reply With Quote #7

You could just check if the user is alive and kill him .
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 04-20-2022 , 01:09   Re: Fastspectate plugin help
Reply With Quote #8

Quote:
Originally Posted by Craxor View Post
You could just check if the user is alive and kill him .
no need to do useless actions. There was a cVar to disable respawn. But i dont know why the author decided to add such thing
I think they could add some timer to prevent respawn after timer end
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 04-20-2022 at 01:13. Reason: uswless -> useless
kww is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 04-20-2022 , 13:25   Re: Fastspectate plugin help
Reply With Quote #9

Quote:
Originally Posted by kww View Post
no need to do useless actions. There was a cVar to disable respawn. But i dont know why the author decided to add such thing
I think they could add some timer to prevent respawn after timer end
Kww, auto respawn and the plugin his trying to make are two different things so is only natural they will interfere one with each other .

Indeed, if the cvar change will solve the problem, no need to kill the user.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
maNIaRO
Member
Join Date: Nov 2014
Old 04-20-2022 , 13:31   Re: Fastspectate plugin help
Reply With Quote #10

As I said in my last post. Problem solved.
It was indeed that cvar which I didn't see it in sma and didn't put it in amxx.cfg.

Please stop wasting your energy replying here.

Thanks again.
maNIaRO is offline
Reply



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 06:58.


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