←  Bugi

AMXX.pl: Support AMX Mod X i SourceMod

»

GmAMXBans
AMXBANS Z POPRAWKAMI BLAD "

Fail - zdjęcie Fail 10.08.2012

Jezeli dam komus bana za pomoca komendy

amx_ban 0 "Mietek Kredka" "Screeny wstaw na Forum"

wyskoczy na stronie amxbansa powod:

"Screeny wstaw na Forum


Mam to tylko w wersji wlasnie tej z poprawkami 1.6, dlaczego cos z tym " nie gra?

gdy zrobie bez cudzyslowiow, w ogóle nie banuje, lub banuja zla osobe, rozne cuda niewidy sie dzieja, a komenda jest mi potrzebna do innych pluginów, a powod bez cudzyslowiu to lipa.
Odpowiedz

  • +
  • -
sebul - zdjęcie sebul 10.08.2012

W pliku "cmdBan.inl" podmień funkcję "cmdBan" na
public cmdBan(id, level, cid) {
/* Checking if the admin has the right access */
if (!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED;

g_menuban_type[id] = 0;

new text[128];
read_args(text, 127);
trim(text);

// get player ident and bantime depending on the ban cmd format
new ban_length[32]
strbreak(text, ban_length, 31, text, 127);
strbreak(text, g_ident, 49, text, 127);

trim(g_ident);
trim(ban_length);

// Check so the ban command has the right format
if(!is_str_num(ban_length) || read_argc() < 3) {
console_print(id, "[AMXBans] %L", id, "AMX_BAN_SYNTAX");
return PLUGIN_HANDLED;
}

// get and format the ban reason
copy(g_choiceReason[id], charsmax(g_choiceReason[]), text);
trim(g_choiceReason[id]);
remove_quotes(g_choiceReason[id]);
trim(g_choiceReason[id]);

//if the reason is empty use the default ban reason from cvar
if(!strlen(g_choiceReason[id])) {
get_pcvar_string(g_Cvars[pc_default_banreason], g_choiceReason[id], charsmax(g_choiceReason[]));
}

g_choiceTime[id] = abs(str_to_num(ban_length));

// This stops admins from banning perm in console if not adminflag n
if(!(get_user_flags(id) & get_higher_ban_time_admin_flag()) && g_choiceTime[id] == 0) {
console_print(id, "[AMXBans] %L", id, "NOT_BAN_PERMANENT");
return PLUGIN_HANDLED;
}

// Try to find the player that should be banned
g_choicePlayerId[id] = locate_player(id, g_ident);

// Player is a BOT or has immunity
if(g_choicePlayerId[id] == -1)
return PLUGIN_HANDLED;

if(g_being_banned[g_choicePlayerId[id]]) {
if(get_pcvar_num(g_Cvars[pc_debug]) >= 1)
log_amx("[AMXBans Blocking doubleban(g_being_banned)] Playerid: %d BanLenght: %s Reason: %s", g_choicePlayerId[id], g_choiceTime[id], g_choiceReason[id]);

return PLUGIN_HANDLED;
}

g_being_banned[g_choicePlayerId[id]] = true;

if(get_pcvar_num(g_Cvars[pc_debug]) >= 1)
log_amx("[AMXBans cmdBan function 1]Playerid: %d", g_choicePlayerId[id]);

if(g_choicePlayerId[id]) {
get_user_authid(g_choicePlayerId[id], g_choicePlayerAuthid[id], charsmax(g_choicePlayerAuthid[]));
get_user_ip(g_choicePlayerId[id], g_choicePlayerIp[id], charsmax(g_choicePlayerIp[]), 1);
}
else {
g_being_banned[0] = false;

console_print(id, "[AMXBans] %L", LANG_PLAYER, "PLAYER_NOT_FOUND", g_ident);

if(get_pcvar_num(g_Cvars[pc_debug]) >= 1)
log_amx("[AMXBans] Player %s could not be found", g_ident);

return PLUGIN_HANDLED;
}

if(!get_ban_type(g_ban_type[id], charsmax(g_ban_type[]), g_choicePlayerAuthid[id], g_choicePlayerIp[id])) {
log_amx("[AMXBans ERROR cmdBan] Steamid / IP Invalid! Bantype: <%s> | Authid: <%s> | IP: <%s>",g_ban_type[id],g_choicePlayerAuthid[id],g_choicePlayerIp[id])
g_being_banned[g_choicePlayerId[id]] = false;
return PLUGIN_HANDLED;
}

new pquery[512];
if(equal(g_ban_type[id], "S")) {
formatex(pquery, charsmax(pquery), "SELECT `player_id` FROM `%s%s` WHERE player_id='%s' AND expired=0", g_dbPrefix, tbl_bans, g_choicePlayerAuthid[id]);

if(get_pcvar_num(g_Cvars[pc_debug]) >= 1)
log_amx("[AMXBans cmdBan] Banned a player by SteamID: %s", g_choicePlayerAuthid[id]);
}
else {
formatex(pquery, charsmax(pquery), "SELECT `player_ip` FROM `%s%s` WHERE player_ip='%s' AND expired=0", g_dbPrefix, tbl_bans, g_choicePlayerIp[id]);

if(get_pcvar_num(g_Cvars[pc_debug]) >= 1)
log_amx("[AMXBans cmdBan] Banned a player by IP/steamID: %s", g_choicePlayerIp[id]);
}

new data[1];
data[0] = id;
if(g_SqlX)
SQL_ThreadQuery(g_SqlX, "cmd_ban_", pquery, data, 1);

return PLUGIN_HANDLED;
}

sebul (10.08.2012 16:29):
Oczywiście potem skompiluj i plik amxx wgraj na serwer.
Odpowiedz

Fail - zdjęcie Fail 11.08.2012

Mam blad:

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

include/amxbans/cmdBan.inl(148) : error 017: undefined symbol "g_Cvars"
include/amxbans/cmdBan.inl(148) : error 017: undefined symbol "pc_default_banreason"
include/amxbans/cmdBan.inl(148) : error 088: number of arguments does not match definition
include/amxbans/cmdBan.inl(148) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.
Odpowiedz

  • +
  • -
sebul - zdjęcie sebul 11.08.2012

Wystarczy, że podmienisz zmienne cvarów na te, które są w standardowej wersji.
Odpowiedz

Fail - zdjęcie Fail 11.08.2012

zamienilem

get_pcvar_string(g_Cvars[pc_default_banreason], g_choiceReason[id], charsmax(g_choiceReason[]));


na

get_pcvar_string(g_Cvars[pcvar_default_banreason], g_choiceReason[id], charsmax(g_choiceReason[]));

lecz teraz mam blad:

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

include/amxbans/cmdBan.inl(147) : error 017: undefined symbol "g_Cvars"
include/amxbans/cmdBan.inl(147) : warning 215: expression has no effect
include/amxbans/cmdBan.inl(147) : error 001: expected token: ";", but found "]"
include/amxbans/cmdBan.inl(147) : error 029: invalid expression, assumed zero
include/amxbans/cmdBan.inl(147) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.
Odpowiedz

  • +
  • -
sebul - zdjęcie sebul 11.08.2012

Bo to trzeba zamienić na
get_pcvar_string(pcvar_default_banreason, g_choiceReason[id], charsmax(g_choiceReason[]));
Odpowiedz

Fail - zdjęcie Fail 11.08.2012

teraz jest blad:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

include/amxbans/cmdBan.inl(166) : error 017: undefined symbol "g_Cvars"
include/amxbans/cmdBan.inl(166) : warning 215: expression has no effect
include/amxbans/cmdBan.inl(166) : error 001: expected token: ";", but found "]"
include/amxbans/cmdBan.inl(166) : error 029: invalid expression, assumed zero
include/amxbans/cmdBan.inl(166) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.

dzięki, skorzystalem z cmdban ze swojej starej wersji amxbansa chyba 1.5

public cmdBan(id, level, cid)
{
	/* Checking if the admin has the right access */
	if (!cmd_access(id,level,cid,3))
		return PLUGIN_HANDLED
	
	g_menuban_type[id] = 0
	
	new ban_length[ 50 ];
	read_argv( 1, ban_length, 49 );
	read_argv( 2, g_ident, 49 );
	read_argv( 3, g_choiceReason[id], 127 );
	
	trim(g_ident)
	trim(ban_length)
	trim(g_choiceReason[id])
	remove_quotes(g_choiceReason[id])
	
	//if the reason is empty use the default ban reason from cvar
	if(!strlen(g_choiceReason[id])) {
		get_pcvar_string(pcvar_default_banreason,g_choiceReason[id],charsmax(g_choiceReason[]))
	}
	
	g_choiceTime[id] = abs(str_to_num(ban_length))
	new cTimeLength[128]
	if (g_choiceTime[id] > 0)
		get_time_length(id, g_choiceTime[id], timeunit_minutes, cTimeLength, 127)
	else
		format(cTimeLength, 127, "%L", LANG_PLAYER, "TIME_ELEMENT_PERMANENTLY")
	
	// This stops admins from banning perm in console if not adminflag n
	if(!(get_user_flags(id) & get_higher_ban_time_admin_flag()) && g_choiceTime[id] == 0)
	{
		client_print(id,print_console,"[AMXBans] %L",LANG_PLAYER,"NOT_BAN_PERMANENT")
		return PLUGIN_HANDLED
	}

	// Try to find the player that should be banned
	g_choicePlayerId[id] = locate_player(id, g_ident)
	
	// Player is a BOT or has immunity
	if (g_choicePlayerId[id] == -1)
		return PLUGIN_HANDLED
		
	if(g_being_banned[g_choicePlayerId[id]]) {
		if ( get_pcvar_num(pcvar_debug) >= 1 )
			log_amx("[AMXBans Blocking doubleban(g_being_banned)] Playerid: %d BanLenght: %s Reason: %s", g_choicePlayerId[id], g_choiceTime[id], g_choiceReason[id])
			
		return PLUGIN_HANDLED
	}
	
	g_being_banned[g_choicePlayerId[id]] = true
	
	if ( get_pcvar_num(pcvar_debug) >= 1 )
		log_amx("[AMXBans cmdBan function 1]Playerid: %d", g_choicePlayerId[id])

	if (g_choicePlayerId[id])
	{
		get_user_authid(g_choicePlayerId[id], g_choicePlayerAuthid[id], 49)
		get_user_ip(g_choicePlayerId[id], g_choicePlayerIp[id], 29, 1)
	}
	else
	{
		g_being_banned[0]=false
		
		console_print(id, "[AMXBans] %L", LANG_PLAYER, "PLAYER_NOT_FOUND",g_ident)

		if ( get_pcvar_num(pcvar_debug) >= 1 )
			log_amx("[AMXBans] Player %s could not be found",g_ident)
				
		return PLUGIN_HANDLED
	}

	if(!get_ban_type(g_ban_type[id],charsmax(g_ban_type[]),g_choicePlayerAuthid[id],g_choicePlayerIp[id])) {
		log_amx("[AMXBans ERROR cmdBan] Steamid / IP Invalid! Bantype: <%s> | Authid: <%s> | IP: <%s>",g_ban_type[id],g_choicePlayerAuthid[id],g_choicePlayerIp[id])
		g_being_banned[g_choicePlayerId[id]]=false
		return PLUGIN_HANDLED
	}
	
	new pquery[1024]
	
	if (equal(g_ban_type[id], "S"))
	{
		formatex(pquery, charsmax(pquery),"SELECT player_id FROM %s%s WHERE player_id='%s' AND expired=0", g_dbPrefix, tbl_bans, g_choicePlayerAuthid[id])
		
		if ( get_pcvar_num(pcvar_debug) >= 1 )
			log_amx("[AMXBans cmdBan] Banned a player by SteamID: %s",g_choicePlayerAuthid[id])
	}
	else
	{
		formatex(pquery, charsmax(pquery),"SELECT player_ip FROM %s%s WHERE player_ip='%s' AND expired=0", g_dbPrefix, tbl_bans, g_choicePlayerIp[id])
		
		if ( get_pcvar_num(pcvar_debug) >= 1 )
			log_amx("[AMXBans cmdBan] Banned a player by IP/steamID: %s",g_choicePlayerIp[id])
	}
	
	
	new data[1]
	data[0] = id
	if(g_SqlX)
	SQL_ThreadQuery(g_SqlX, "cmd_ban_", pquery, data, 1)
	
	return PLUGIN_HANDLED;
}



i banuje wporzadku :D

Cos niemoge zedytowac postu, ale dobra, bo to chyba za pozno sie kaplem. Jest taki maly problemik, chodzi o nick np ktos sie nazywa:

Mietek Kran

a drugi sie nazywa

Mietek Kranik

i banuje przez komende:

amx_ban 0 "Mietek Kran" "Screeny wstaw na Forum"

to pisze ze istnieje wielu graczy pasujacych do podanego wzorca? czy tam kilku graczy xD to nie idzie zrobic zeby bralo pod uwage dokladna nazwe?:> Jak Kranika banuje to kranika, a jak kran to kran?
Użytkownik Fail edytował ten post 11.08.2012 17:29
Odpowiedz

Fail - zdjęcie Fail 02.09.2012

i co idzie zrobic, aby pobieralo dokladna nazwe z "" bo czesto wyskakuje ze istnieje wielu graczy pasujacych do podanego wzorca, czy od czego to zalezy?
REFRESH!
Odpowiedz

Fail - zdjęcie Fail 06.10.2012

refresh
Odpowiedz