Raised This Month: $2 Target: $400
 0% 

Can some1 fix this 1 compile error..


Post New Thread Reply   
 
Thread Tools Display Modes
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-25-2017 , 23:53   Re: Can some1 fix this 1 compile error..
Reply With Quote #11

Try below:

Code:
#include <amxmodx>

#define TASK_TEAM 2017
new g_iCount[33] 

new const MAX_TIME = 30 
new const WORD_KICK[] = "Do not choose a team"

public plugin_init() 
{ 
	register_plugin("No Team Unassigned", "1.0", "zmd94")
	register_event("TeamInfo", "fwPlayerJoinedTeam", "a") 
}

public client_putinserver(id) 
{ 
	if(is_user_connected(id))
	{
		g_iCount[id] = MAX_TIME
		set_task(1.0, "CheckTeam", id+TASK_TEAM, _, _, "b")
	}
}

public CheckTeam(id) 
{
	id -= TASK_TEAM
	if(is_user_connected(id))
	{
		g_iCount[id]--
		if(g_iCount[id] == 0) 
		{
			server_cmd("kick #%d ^"%s^"", get_user_userid(id), WORD_KICK) 
		}
		
		client_print(id, print_center, "You have %d s to choose a team", g_iCount[id]) 
	}
}

public fwPlayerJoinedTeam() 
{ 
	new id = read_data(1)
	if(is_user_connected(id)) 
	{
		static sUserTeam[32]
		read_data(2, sUserTeam, charsmax(sUserTeam)) 
		
		switch(sUserTeam[0])
		{
			case 'C':  
			{
				// player join to ct's    
				remove_task(id+TASK_TEAM) 
				g_iCount[id] = 0 				
			}
			case 'T': 
			{
				// player join to terrorist
				remove_task(id+TASK_TEAM) 
				g_iCount[id] = 0 
			}
			case 'S':  
			{
				// player join to spectators
				// Do nothing?
			}
		}
	} 
}

public client_disconnect(id) 
{
	g_iCount[id] = 0 
	remove_task(id+TASK_TEAM) 
}
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 12-28-2017 at 01:39.
zmd94 is offline
blood2k
Senior Member
Join Date: Mar 2014
Old 12-26-2017 , 01:34   Re: Can some1 fix this 1 compile error..
Reply With Quote #12

thanks boss, the compiling works for sure... just didn't know that this plugin wasn't really coded properly. Figured out it doesnt remove the task when user is ASSIGNED, still keeps kicking.
blood2k is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-26-2017 , 07:50   Re: Can some1 fix this 1 compile error..
Reply With Quote #13

Fixed:

https://forums.alliedmods.net/showpo...3&postcount=11
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
blood2k
Senior Member
Join Date: Mar 2014
Old 12-26-2017 , 08:45   Re: Can some1 fix this 1 compile error..
Reply With Quote #14

Works great
blood2k is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-28-2017 , 01:37   Re: Can some1 fix this 1 compile error..
Reply With Quote #15

Nice, I'm glad can help you.
__________________
Problem with ZP?
ZP Helper!
zmd94 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 18:06.


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