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

Solved [REQ]Set task on plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Undercloacked
Member
Join Date: Jun 2012
Old 12-13-2018 , 02:00   [REQ]Set task on plugin
Reply With Quote #1

Not good at all on these, so could you please help a brother out? I need this to be enabled(amx_blockteams 1) after 28 minutes in the map.

Code:
#include <amxmodx>
#include <cstrike>
/*
Changelog:
v1.0 - Public Release
v1.1 - Quick Changes on plug.
-----------------------------
v1.2 - Fixs:
- Language Changed to default english.
- Added a cvar for enable and disable the plugin
v1.3 - Fix:
- Disable cstrike and engine, cause they are not necesary.
v1.4 - Fix:
- Add an access level for change the cvar, and by default is disabled.
-----------------------------
v2.0 - Fixs:
- Detects Spects.
- Add module cstrike, needed to work.
- Clean of the code

Cvar:
amx_blockteams - 1/0 - Enable/Disable Lock teams. ( Requires admin_kick level for change )
*/
//Defines
#define PLUGIN "Block Team Change"
#define VERSION "2.0"
#define AUTHOR "CAMEL"
//Symbols
new blockit

	public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	blockit = register_cvar("amx_blockteams","1")
	register_clcmd("chooseteam", "cmdChooseTeam")

}
	public cmdChooseTeam(id)
{
	if(!get_pcvar_num(blockit))  // cvar detect
	return PLUGIN_CONTINUE
	if ( get_user_flags(id) & ADMIN_KICK ) // if is admin can change of team
	return PLUGIN_HANDLED;
	if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
	return PLUGIN_HANDLED;
	client_print(id, print_chat, "[AMX] You don't have the aproppiate access to choose team.");
	return PLUGIN_HANDLED;
}
Do not bother commenting on the plugin's quality, it aint mine, but does the job.

Thanks in advance.

Last edited by Undercloacked; 12-15-2018 at 23:49.
Undercloacked is offline
Undercloacked
Member
Join Date: Jun 2012
Old 12-15-2018 , 23:49   Re: [REQ]Set task on plugin
Reply With Quote #2

Just in case anyone else has a similar issue, I figured it out:

Change
Code:
//Symbols
new blockit

	public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	blockit = register_cvar("amx_blockteams","1")
	register_clcmd("chooseteam", "cmdChooseTeam")

}
	public cmdChooseTeam(id)
{
	if(!get_pcvar_num(blockit))  // cvar detect
	return PLUGIN_CONTINUE
	if ( get_user_flags(id) & ADMIN_KICK ) // if is admin can change of team
	return PLUGIN_HANDLED;
	if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
	return PLUGIN_HANDLED;
	client_print(id, print_chat, "[AMX] You don't have the aproppiate access to choose team.");
	return PLUGIN_HANDLED;
}
to
Code:
//Symbols
new blockit

	public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	blockit = register_cvar("amx_blockteams","1")
	register_clcmd("chooseteam", "cmdChooseTeam")
	set_task(1740.0, "Task_BlockTeam",_,_,_,"c",_)
}

public Task_BlockTeam()
{
set_pcvar_num(blockit, 1);
}

	public cmdChooseTeam(id)
{
	if(!get_pcvar_num(blockit))  // cvar detect
	return PLUGIN_CONTINUE
	if ( get_user_flags(id) & ADMIN_KICK ) // if is admin can change of team
	return PLUGIN_HANDLED;
	if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
	return PLUGIN_HANDLED;
	client_print(id, print_chat, "[AMX] You don't have the appropriate access to choose team.");
	return PLUGIN_HANDLED;
}
Undercloacked 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 07:19.


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