Raised This Month: $ Target: $400
 0% 

Fastspectate plugin help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


Thread Tools
Display Modes

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 21:21.


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