Raised This Month: $ Target: $400
 0% 

AMX MOTD v0.2


Post New Thread Reply   
 
Thread Tools Display Modes
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-14-2006 , 13:42  
Reply With Quote #31

Thanks for the suggestion. I've made a temp fix for it that will hopefully work.

I created a variable for multiple file names and it'll search for that file name. If it comes up it'll be blocked and the command will be logged along with the admin's steamid/name.

Code:
#define MAX_BANNED 7 static const BANNED_FILES[MAX_BANNED][] = {     "server.cfg",     "listenserver.cfg",     "liblist.gam",     "users.ini",     "plugins.ini",     "banned.cfg",     "sql.cfg" }
Just keep adding on to them. You must increment MAX_BANNED each time you add one. And the last one must not have a comma after it.

Let me know if it works
Attached Files
File Type: sma Get Plugin or Get Source (amx_motd.sma - 1053 views - 3.4 KB)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Hadow
New Member
Join Date: May 2006
Location: Sweden
Old 05-16-2006 , 11:56  
Reply With Quote #32

Yes and no, it works but you can still get the file Server.cfg if you write it whit a big “S” and this amx_motd hadow "addons\amxmodx\configs\sql.cfg" "test" still works!

I have made I little modification from your plugin that’s works so you only can open files from motd directory.

Is it all right for me to post it in her v3x?

Best regards
Hadow
Hadow is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-16-2006 , 23:53  
Reply With Quote #33

Yeah, sure.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Hadow
New Member
Join Date: May 2006
Location: Sweden
Old 05-18-2006 , 00:19  
Reply With Quote #34

I’m stuck how do I search in a String after ../ this.

I can still get the file server.cfg when I’m doing this,

Code:
amx_motd hadow "czero/..\../server.cfg" "test"

so how do I do to make it find ../ in there?

is it possible to search a String using some sort of wildcard like this *../* or something to make it stop?

I have find an easy way, but then I can’t have more then 9 letters in arg2 to protect it so they cant type in long words. There must be some way to make it stop getting files in the czero directory and odder places?

I want it so it only can get files from the directory motd is it doable?

That’s was many questions sorry for that v3x but I’m quite new at amx scripts, + it’s a long time sins I programmed

Code:
#include <amxmodx>
#include <amxmisc>

static const PLUGIN[]="AMX MOTD"
static const VERSION[]="0.2"
static const AUTHOR[]="v3x"

#define ACCESS_LEVEL	ADMIN_BAN
// Change if needed
#define MAX_BANNED	27

public plugin_init() {
	register_plugin(PLUGIN,VERSION,AUTHOR)
	register_clcmd("amx_motd","show_window",ADMIN_KICK,"<name,@team,*(all)> <file.ext> <title>")
	register_srvcmd("amx_motd","show_window",-1,"<name,@team,*(all)> <file.ext> <title>")
}

new bool:isCT
new bool:isTE
new bool:isALL

static const BANNED_CD[MAX_BANNED][] = {
	"...",
	"/..",
	"//.",
	"///",
	".//",
	"../",
	"\..",
	"\\.",
	"\\\",
	".\\",
	"..\",
	"./.",
	".\.",
	"/./",
	"\.\",
	"/.\",
	"\./",
	"\/.",
	"/\.",
	".\/",
	"./\",
	"\/\",
	"/\/",
	"//\",
	"\\/",
	"/\\",
	"\//"
}

public show_window(id,lvl,cid) {

	if(!cmd_access(id,lvl,cid,4))
		return PLUGIN_HANDLED

	new name[33],authid[33],filename[64],bandir[3],arg1[32],arg2[64],arg3[64],players[32],num,i

	read_argv(1,arg1,31)
	read_argv(2,arg2,63)
	read_argv(3,arg3,63)

	remove_quotes(arg2)
	remove_quotes(arg3)
	trim(arg2)
	parse(arg2,bandir,3)
	format(filename, 63, "motd\%s", arg2)

	get_user_name(id , name , 32)
	get_user_authid(id , authid , 32)

	for(new i = 0; i < MAX_BANNED; i++) {
		if(!contain(bandir , BANNED_CD[i])) {
			console_print(id , "[AMXX] You may not chance directory!")
			log_amx("%s (%s) used command ^"amx_motd %s %s %s^" to chance directory!" , name , authid , arg1 , arg2 , arg3)
			return PLUGIN_HANDLED
		}
	}

	if(!strlen(arg2)) {
		console_print(id,"[AMXX] No file path specified!")
		return PLUGIN_HANDLED
	}

	if(!file_exists(filename)) {
		console_print(id,"[AMXX] File doesn't exist!")
		log_amx("%s (%s) used command ^"amx_motd %s %s %s^"", name, authid, arg1, arg2, arg3)
		return PLUGIN_HANDLED
	}

	if(arg1[0]=='@') {

		if(equali(arg1[1],"A") 
		|| equali(arg1[1],"ALL")) {
			isALL = true
			isCT = false
			isTE = false
			get_players(players,num,"c")
		}
		
		if(equali(arg1[1],"TERRORIST") 
		|| equali(arg1[1],"T") 
		|| equali(arg1[1],"TERROR") 
		|| equali(arg1[1],"TE") 
		|| equali(arg1[1],"TER")) {
			isALL = false
			isCT = false
			isTE = true
			get_players(players,num,"ce","TERRORIST")	
		}
		
		if(equali(arg1[1],"CT")
		|| equali(arg1[1],"C") 
		|| equali(arg1[1],"COUNTER")) {
			isALL = false
			isCT = true
			isTE = false
			get_players(players,num,"ce","CT")	
		}

		for(i=0;i<num;i++) {

			if(!num) {
				console_print(id,"[AMXX] No players on such team!")
				return PLUGIN_HANDLED
			}

			if(is_user_connected(players[i]))
				show_motd(players[i],filename,arg3)
			log_amx("%s (%s) used command ^"amx_motd %s %s %s^"", name, authid, arg1, arg2, arg3)
		}

		if(isALL == true) {
			console_print(id,"[AMXX] ^"%s^" shown to everyone")
			server_print("[AMXX] ^"%s^" shown to everyone")	
		}
		if(isCT == true) {
			console_print(id,"[AMXX] ^"%s^" shown to CTs")
			server_print("[AMXX] ^"%s^" shown to CTs")	
		}
		if(isTE == true) {
			console_print(id,"[AMXX] ^"%s^" shown to Terrorists")
			server_print("[AMXX] ^"%s^" shown to Terrorists")	
		}
	}

	else if(arg1[0]=='*') {

		get_players(players,num,"c")

		for(i=0;i<num;i++) {

			if(!num) {
				console_print(id,"[AMXX] No players found!")
				return PLUGIN_HANDLED
			}

			if(is_user_connected(players[i]))
				show_motd(players[i],filename,arg3)
			log_amx("%s (%s) used command ^"amx_motd %s %s %s^"", name, authid, arg1, arg2, arg3)
		}

		console_print(id,"[AMXX] ^"%s^" shown to everyone",arg2)
	}

	else {

		new player = cmd_target(id,arg1,0)

		if(!is_user_connected(player))
			return PLUGIN_HANDLED

		show_motd(player,filename,arg3)

		console_print(id,"[AMXX] ^"%s^" shown to %s",arg2,arg1)
		server_print("[AMXX] ^"%s^" shown to %s",arg2,arg1)
		log_amx("%s (%s) used command ^"amx_motd %s %s %s^"", name, authid, arg1, arg2, arg3)
	}

	return PLUGIN_HANDLED
}
[/code]
Hadow is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-18-2006 , 00:24  
Reply With Quote #35

Code:
for(new i = 0; i < MAX_BANNED; i++) {   if(!contain(string , BANNED_CD[i]))   {     // ..     return PLUGIN_HANDLED;   } }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Hadow
New Member
Join Date: May 2006
Location: Sweden
Old 05-18-2006 , 09:33  
Reply With Quote #36

I hope you don’t mind that I fixed this.

Code:
/* AMXX Mod script. * * Made by v3x/Hadow * This file is provided as is (no warranties). * * AMX MOTD v0.3 * [2006-05-18 -- last change] * * CREDITS: * -------- * v3x ho made this and the AMXX Community * ---------------------------------------------------------------------------------- Installation 1) Put the amx_motd.amxx into your addons/amxmodx/plugins folder. 2) Go into your addons/amxmodx/configs/plugins.ini, at the very bottom    type in amx_motd.amxx, save it. 3) Make a directory motd beside the addons directory ware all wad files are. 4) Copy the main motd.txt to motd directory if you want. You must do this if    you want to show the main motd messages to the players. Now make different messages and put them in the motd directory to send to player. ---------------------------------------------------------------------------------- Examples (I'll use rules.txt for these examples): Single player: amx_motd v3x "rules.txt" "Follow the rules" All players: amx_motd @A "rules.txt" "Follow these rules" amx_motd @ALL "rules.txt" "Follow these rules" amx_motd * "rules.txt" "Follow these rules" Terrorist team: amx_motd @T "rules.txt" "Follow these rules" amx_motd @TE "rules.txt" "Follow these rules" amx_motd @TER "rules.txt" "Follow these rules" amx_motd @TERROR "rules.txt" "Follow these rules" amx_motd @TERRORIST "rules.txt" "Follow these rules" Counter-Terrorist team: amx_motd @C "rules.txt" "Follow these rules" amx_motd @CT "rules.txt" "Follow these rules" amx_motd @COUNTER "rules.txt" "Follow these rules" ---------------------------------------------------------------------------------- V0.3 * Fixed a security issue. */

Code:
static const BANNED_CD[MAX_BANNED][] = {
	"...",
	"/..",
	"//.",
	"///",
	".//",
	"../",
	"\..",
	"\\.",
	"\\\",
	".\\",
	"..\",
	"./.",
	".\.",
	"/./",
	"\.\",
	"/.\",
	"\./",
	"\/.",
	"/\.",
	".\/",
	"./\",
	"\/\",
	"/\/",
	"//\",
	"\\/",
	"/\\",
	"\//"
}
Code:
for(new i = 0; i < MAX_BANNED; i++) {   if(~contain(string , BANNED_CD[i]))   {     // ..     return PLUGIN_HANDLED;   } }
Attached Files
File Type: sma Get Plugin or Get Source (amx_motd.sma - 931 views - 5.7 KB)
Hadow is offline
Mukade
Junior Member
Join Date: Oct 2005
Old 07-11-2006 , 04:45   Bug Report ?
Reply With Quote #37

Good morning.

I installed this plugin on my CS server today and when i try to use it i have an error. The server was empty and i had this.
Code:
amx_motd @T "motd.txt" "Lis les regles"
L 07/11/2006 - 10:40:37: String formatted incorrectly - parameter 3 (total 2)
L 07/11/2006 - 10:40:37: [AMXX] Displaying debug trace (plugin "amx_motd.amxx")
L 07/11/2006 - 10:40:37: [AMXX] Run time error 25: parameter error 
L 07/11/2006 - 10:40:37: [AMXX]    [0] amx_motd.sma::show_window (line 96)
I use AMXMODX v1.71 and MetaMod v1.19p28. The modules loaded are
Code:
 [ 1] Fun                     1.71     AMX Mod X Dev Team   running    
 [ 2] Engine                  1.71     AMX Mod X Dev Team   running    
 [ 3] FakeMeta                1.71     AMX Mod X Dev Team   running    
 [ 4] CStrike                 1.71     AMX Mod X Dev Team   running    
 [ 5] CSX                     1.71     AMX Mod X Dev Team   running    
 [ 6] Sockets                 1.71     HLSW Dev Team        running    
 [ 7] RegEx                   1.71     AMX Mod X Dev Team   running

Last edited by Mukade; 07-11-2006 at 06:13.
Mukade is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 07-11-2006 , 15:27   Re: AMX MOTD v0.2
Reply With Quote #38

Updated (v0.2)! Thanks for the report.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
mercury
Member
Join Date: Jun 2004
Old 07-15-2006 , 02:36   Re: AMX MOTD v0.2
Reply With Quote #39

v3x, ok, but what if just immediately push ok and close the window? is it possible to disable "OK" for a time?
mercury is offline
Micketorneus
Junior Member
Join Date: Jul 2007
Location: Sweden
Old 07-16-2007 , 16:45   Re: AMX MOTD v0.2
Reply With Quote #40


Last edited by Micketorneus; 07-16-2007 at 16:48.
Micketorneus is offline
Send a message via MSN to Micketorneus
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 08:24.


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