Raised This Month: $ Target: $400
 0% 

can someone help me...?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
timothy0711
New Member
Join Date: Aug 2012
Old 08-11-2012 , 15:23   can someone help me...?
Reply With Quote #1

Can someone can help me change it to amxx ???
It is a chatting system
I have no idea why i cannot change it to amxx.

There are one error called
error 010: invalid function or declaration
in line <1>.

Maybe it cannot change to amxx because i have added some chinese words?



Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <nvault>
#define MAX_WORDS 192

new const PLUGIN[] = "Hook system final"
new const VERSION[] = "3.5"
new const AUTHOR[] = "WS.Chu:)"
static const VAULTNAME[] = "signature"
new const SYS_PLUGIN_NAME[] = "\y插件名稱^n\r"
new const SYS_PLUGIN_AUTHOR[] = "\y插件作者^n\r"
new const SYS_PLUGIN_VERSION[] = "\y插件版本^n\r"
new const SYS_PLUGIN_DB[] = "\y資料庫^n\r"

new iMessages[256];
new iUserName[32], iTag[24], iPlayerTag[24] = "[普通玩家]";
new iUserAlive, iUserTeam;
new tUserTeam[16], tUserAlive[10];
new gSayText, gMaxplayers;
new szVault, szName[33][35];
new cmdType;
new iHideTag;
new CHARS_MIN = 6, CHARS_MAX = 26;
new SwearsNames[MAX_WORDS][32];
new gSwearsNum;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd("say", "cmdHookSay");
	register_clcmd("say_team", "cmdHookSayTeam");
	
	cmdType = register_cvar("amx_hook_sysf_type", "0");
	
	register_cvar(SYS_PLUGIN_NAME, PLUGIN, FCVAR_SERVER|FCVAR_SPONLY);
	register_cvar(SYS_PLUGIN_AUTHOR, AUTHOR, FCVAR_SERVER|FCVAR_SPONLY);
	register_cvar(SYS_PLUGIN_VERSION, VERSION, FCVAR_SERVER|FCVAR_SPONLY);
	register_cvar(SYS_PLUGIN_DB, VAULTNAME, FCVAR_SERVER|FCVAR_SPONLY);
	
	szVault = nvault_open(VAULTNAME) 
	
	gSayText = get_user_msgid("SayText");
	gMaxplayers = get_maxplayers();
	
	if(get_pcvar_num(cmdType) >= 3)
	{
		server_cmd("amxx pause hook_sys.amxx");
		server_print("[ERROR] Cvar ^"hook_sys_type^" effective value are ^"0^" and ^"1^".");
		server_print("[ERROR] Plugin info: %s %s %s, auto pause plugin.", PLUGIN, VERSION, AUTHOR);
	}
	
	readList()
}

readList() 
{ 
    // file to read words from 
	new szConfigdir[64];
	new szFileName[64];
	get_configsdir(szConfigdir, 63);
	formatex(szFileName, 63, "%s/swear/swearwords.ini", szConfigdir);

	if(!file_exists(szFileName))
	{
		server_print("[ERROR] Swear Filter: file %s not found.", szFileName);
		return;
	}
	new iLen 
	while(gSwearsNum < MAX_WORDS && read_file(szFileName, gSwearsNum ,SwearsNames[gSwearsNum][1], 30, iLen))
	{ 
		if(SwearsNames[gSwearsNum][0] == ';') continue;
		SwearsNames[gSwearsNum][0] = iLen;
		++gSwearsNum;
	}
	server_print("[AMXX] Swear Filter: loaded %d words", gSwearsNum);
} 

public client_authorized(id)
{
    get_user_name(id , szName[id] , charsmax(szName[]));
}

public plugin_end()
{
    nvault_close(szVault);
}

public cmdHookSay(id)
{
	read_args(iMessages, 255);
	remove_quotes(iMessages);
	
	get_user_name(id, iUserName, 31);
	
	if(!is_valid_msg(iMessages))
		return PLUGIN_HANDLED;
	
	CheckSwears(id);
	
	if(get_user_flags(id) & ADMIN_LEVEL_A)
		iTag = "[場主]";
	else if(get_user_flags(id) & ADMIN_LEVEL_B)
		iTag = "[高級管理員]";
	else if(get_user_flags(id) & ADMIN_LEVEL_C)
		iTag = "[管理員]";
	else if(get_user_flags(id) & ADMIN_LEVEL_D)
		iTag = "[高級團員]";
	else if(get_user_flags(id) & ADMIN_LEVEL_E)
		iTag = "[團員]";
	else
		iTag = iPlayerTag;
	
	iUserAlive = is_user_alive(id);
	
	new szKey[32], szSingature[26], iSignature[26];
	
	formatex(szKey, 31, "%s-Signature", szName[id]);
	formatex(szSingature, charsmax(szSingature), "%s", iMessages[5]);
	
	if(iMessages[0] == '/' && iMessages[1] == 'm' && iMessages[2] == 's' && iMessages[3] == 'g' && iMessages[4] == ' ')
	{
		new iMsg = strlen(iMessages);
		
		if(iMsg < CHARS_MIN)
		{
			client_color(id, id, "[提示] 您所鍵入的個性簽名太短了。(下限: %d 個英文字或中文字)", CHARS_MIN - 5);
		}
		else if(iMsg > CHARS_MAX)
		{
			client_color(id, id, "[提示] 您所鍵入的個性簽名太長了。(上限: %d 個英文字或 %d 個中文字)", CHARS_MAX - 5, (CHARS_MAX - 5) / 3);
		}
		else
		{
			client_color(id, id, "[提示] 您現在的個性簽名:^"%s^"。", iMessages[5]);
			nvault_set(szVault, szKey, szSingature);
		}
		return PLUGIN_HANDLED;
	}
	
	if(equal(iMessages, "/delmsg"))
	{
		formatex(szSingature, charsmax(szSingature), "沒有稱號");
		nvault_set(szVault, szKey, szSingature);
			
		client_color(id, id, "[提示] 您現在的個性簽名已經刪除。");
		
		return PLUGIN_HANDLED;
	}
	
	formatex(szKey, 31, "%s-Signature", szName[id]);
	
	if(nvault_get(szVault, szKey, szSingature, charsmax(szSingature)))
		formatex(iSignature, charsmax(iSignature), "%s", szSingature);
	else
		formatex(iSignature, charsmax(iSignature), "沒有稱號");
	
	if(get_pcvar_num(cmdType) == 0)
	{
		client_color(0, id, "^x01%s^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iSignature, iUserName, iMessages);
		client_print(0, print_console, "%s[%s] %s : %s", is_UserAlive(), iSignature, iUserName, iMessages);
	}
	else if(get_pcvar_num(cmdType) == 1)
	{	if(is_user_admin(id))
		{
			if(equal(iMessages, "/hide"))
			{
				iHideTag = 1;
				client_color(id, id, "[提示] 您的管理員標籤將由 %s 變成 %s。", iTag, iPlayerTag);
				return PLUGIN_HANDLED;
			}
			if(equal(iMessages, "/show"))
			{
				iHideTag = 0;
				client_color(id, id, "[提示] 您的管理員標籤將由 %s 還原成 %s。", iPlayerTag, iTag);
				return PLUGIN_HANDLED;
			}
		}
		else if(!is_user_admin(id))
		{
			iHideTag = 0;
		}
		if(iHideTag == 1)
		{
			client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
			client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iPlayerTag, iSignature, iUserName, iMessages);
		}
		else if(iHideTag == 0)
		{
			client_color(0, id, "^x01%s^x04%s ^x04[^x01%s^x04] ^x03%s ^x01: %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
			client_print(0, print_console, "%s%s [%s] %s : %s", is_UserAlive(), iTag, iSignature, iUserName, iMessages);
		}
	}
	return PLUGIN_HANDLED;
}

public cmdHookSayTeam(id)
{
	read_args(iMessages, 255);
	remove_quotes(iMessages);	
	
	get_user_name(id, iUserName, 31);
	
	if(!is_valid_msg(iMessages))
		return PLUGIN_HANDLED;
		
	CheckSwears(id);
		
	iUserAlive = is_user_alive(id);
	iUserTeam = get_user_team(id);
	
	if(iMessages[0] != '@')
	{
		static player;
		
		for(player = 1; player <= gMaxplayers; player++)
		{
			if(get_user_team(player) == iUserTeam)
				client_color(player, id, "^x01%s^x03%s %s ^x01: %s", is_UserAlive(), i_UserTeam(), iUserName, iMessages);
		}
	}
	else
	{
		if(get_user_flags(id) & ADMIN_ADMIN)
			iTag = "(ADMIN)"
		else
			iTag = "(PLAYER)"
		
		new iPlayers[32], iNum;
		get_players(iPlayers, iNum, "ch");
		
//		for(new i = 0; i < iNum; i++)
//		{
//			if(get_user_flags(iPlayers[i]) & ADMIN_CHAT)
//			{
//				client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
//			}
//			else if(!is_user_admin(iPlayers[i]))
//			{
//				client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
//			}
//		}
		for(new i = 0; i < iNum; i++) 
		{ 
			if(get_user_flags(iPlayers[i]) & ADMIN_CHAT && id != iPlayers[i]) 
			{ 
				client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]); 
			} 
		}
		client_color(id, id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);  
	}
	return PLUGIN_HANDLED;
}

public CheckSwears(id)
{
	new pos, i = 0;
	
	while (i < gSwearsNum)
	{
		if((pos = containi(iMessages, SwearsNames[i][1])) != -1 )
		{ 
			new len = SwearsNames[i][0] 
			while(len--)
			iMessages[pos++] = '*';
			continue;
		}
		++i
	}
	return PLUGIN_HANDLED;
}

bool:is_valid_msg(const iMessages[])
{
	if(iMessages[0] == '%' || !strlen(iMessages) || equal(iMessages, "") || equal(iMessages, " "))
	{
		return false;
	}
	return true;
}

public i_UserTeam()
{
	switch(iUserTeam)
	{
		case 0: copy(tUserTeam, sizeof(tUserTeam) - 1,"( SPEC )");
		case 1: copy(tUserTeam, sizeof(tUserTeam) - 1,"( TS )");
		case 2: copy(tUserTeam, sizeof(tUserTeam) - 1,"( CT )");
		case 3: copy(tUserTeam, sizeof(tUserTeam) - 1,"( SPEC )");
	}
	return tUserTeam;
}

public is_UserAlive()
{
	if(!iUserAlive && 0 < iUserTeam < 3)
		copy(tUserAlive, sizeof(tUserAlive) - 1,"*陣亡* ");
	else
		copy(tUserAlive, sizeof(tUserAlive) - 1,"");
	return tUserAlive;
}

stock client_color(index, color, const msg[], any:...) 
{
	static szMessage[192]
	szMessage[0] = 0x04
	vformat(szMessage[1], charsmax(szMessage)-1, msg, 4)
	
	static iSayText
	if (iSayText || (iSayText = gSayText))
	{
		message_begin(index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, _, index)
		{
			write_byte(color)
			write_string(szMessage)
		}
		message_end()
	}
}

Last edited by timothy0711; 08-11-2012 at 15:24.
timothy0711 is offline
 



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 05:50.


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