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

Can some1 fix this 1 compile error..


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


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 17:43.


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