Raised This Month: $7 Target: $400
 1% 

spec switch bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AGONN
Member
Join Date: Jan 2018
Old 02-15-2018 , 15:07   spec switch bug
Reply With Quote #1

hi , i'm using a plugin spec switch but some guys using a bug in this plugin to crash my server , they retry then they don't shoose player model they open consol then say use /spec then they shoose player model so server crash , any solution for this bug ?

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "Spec Switch"
#define VERSION "0.1.3"
#define AUTHOR "many"

new CsTeams:zTeam[33]
new zDeath[33]
new bool:type_spec[33] = false
new g_cvar

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	/* Cvar */
	g_cvar	= register_cvar("amx_specmode",	"0") 	// 0 - enable use to all, 1 - enable use only ADMINs
	/* Client Commands */
	register_clcmd("say /spec", 		"cmdSpec", ADMIN_ALL, "- go to spectator")
	register_clcmd("say_team /spec", 	"cmdSpec", ADMIN_ALL, "- go to spectator")
	register_clcmd("say /back", 		"cmdBack", ADMIN_ALL, "- go back to your team")
	register_clcmd("say_team /back", 	"cmdBack", ADMIN_ALL, "- go back to your team")
}

public cmdSpec(id)
{
	if(!get_pcvar_num(g_cvar)) Spec(id)
	else if( get_pcvar_num(g_cvar) && (get_user_flags(id) & ADMIN_KICK)) Spec(id)
	else if( get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK)) PrintUserNotAdmin(id)
}

public cmdBack(id)
{
	if (type_spec[id] && cs_get_user_team(id) == CS_TEAM_SPECTATOR && zTeam[id] != CS_TEAM_SPECTATOR ) Back(id)
	else if( get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK) ) PrintUserNotAdmin(id)
}

public Spec(id)
{
	zDeath[id] = cs_get_user_deaths(id)
	if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
	return
	else{
		type_spec[id] = true
		zTeam[id] = cs_get_user_team(id)
		cs_set_user_team(id, CS_TEAM_SPECTATOR)
		user_silentkill(id)
		client_print(id,print_chat,"Type /back to return from Spectator")
	}
	return
}

public Back(id)
{
	cs_set_user_team(id, zTeam[id])
	cs_set_user_deaths(id, zDeath[id])
	set_task(0.5,"FirstRespawn",id)
	set_task(0.8,"SecondRespawn",id)
}

public FirstRespawn(id)
{
	cs_user_spawn(id)
}

public SecondRespawn(id)
{
	cs_user_spawn(id)
	if (cs_get_user_team(id) == CS_TEAM_T){
		give_item(id,"weapon_knife")
		give_item(id,"weapon_glock18")
		give_item(id,"ammo_9mm")
	}
	if (cs_get_user_team(id) == CS_TEAM_CT){
		give_item(id,"weapon_knife")
		give_item(id,"weapon_usp")
		give_item(id,"ammo_45acp")
		give_item(id,"ammo_45acp")
	}
}

PrintUserNotAdmin(id)
{
	client_print(id,print_chat,"Only Admins can use /spec, /back command")
}

public PrintRule(id)
{
	if ( is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id) ){
		client_print(id,print_chat,"Type /spec if you want to go Spectator")
		client_print(id,print_chat,"Type /back to return from Spectator")
	}
}

public client_putinserver(id)
{
	if(!get_pcvar_num(g_cvar)) Rule(id)
	else if( get_pcvar_num(g_cvar) && (get_user_flags(id) & ADMIN_KICK)) Rule(id)
}

public client_disconnect(id) type_spec[id] = false
public client_connect(id) type_spec[id] = false
public Rule(id) set_task(20.0, "PrintRule", id)

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n{\\ colortbl ;\\ red0\\ green0\\ blue0;}\n\\ viewkind4\\ uc1\\ pard\\ cf1\\ lang1033\\ b\\ f0\\ fs16 \n\\ par }
*/
AGONN is offline
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 02-16-2018 , 06:17   Re: spec switch bug
Reply With Quote #2

The plugin you're using is an unapproved plugin. Also next time post in the request section. Scripting section is for those who make their own code.
Use this: https://amxx-bg.info/viewtopic.php?f=21&t=1114
WhiteFang1319 is offline
Reply


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 03:44.


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