Dialog help
#1

Hey guys, i need help. There is hack in one gamemode, in which if you type "%sC" or "%sB" to the login dialog, it crashes server, depends on letter. %s is nickname of player, so for example if someone is nammed Lol and he registers with password LolC then logs out and logins with password LolC it crashes the server. Via my little script, which i made for myself i found out which dialogid is the login dialog, because i have just amx file, so i need you guys to help me script this. I think we are going to work in OnDialogResponse and we will use inputtext and strfind, but i am not sure, how to do it, so if one of you guys would be enable to help me make this little security system, i would give you +1 and i will be really thankful.
Reply
#2

I don't understand,explain more please
Reply
#3

Show us codes buddy..
Reply
#4

I have no codes, because i have no idea, how to "build" them. Only code i have made, was for getting the dialogid from the amx file, so i can operate with it.

Alright, i will try to explain more ->

There is hack in amx gamemode, which is verry popular in our country and i want to use it and modify it via filterscripts, so my players have more fun and reason to visit my server.

No-one except the developer has the .pwn folder, and he is not selling it to anyone. Gamemode has also anti-deamx.

In the gamemode, there is a hack, via which you can for example shutdown server or get the rcon password, it works from the login dialog.

So, for example if your name is Michael and you go on my server and register with password MichaelC, then you exit the game and go on the server again, so there is going to be login dialog, so when you write into this dialog your password MichaelC the server will shutdown.

Remember the letter at the end of password, there are few leters such as A, B,C and each letter at the end of the name does different function, so for example server shutdown, rcon detection or gives the player automatic admin-level 5.

So what i need is security for this, if player writes his name and letter A,B or C into the dialog, it kicks him out.

I am not sure how to build this, but i maybe know what i am going to need : work with inputtext, use strfind and Kick(playerid);

So if one of you guys would be enable to help me, to write me such as security script with descriptions of each function, i would be really thankful and also REP +1 to YOU.

Hope you understaned now.
Reply
#5

Under OnDialogResponse(playerid, ...):

Код:
(YOUR_DIALOG_ID):
{
	if(!response) return Kick(playerid);
	if(response)
	{
		new length; //defining a variable
		length = strlen(inputtext); // storing the length of the inputtext(password)
		if(strfind(inputtext, "A", false, length)) //checks if the password contains letter "A" at last
		{
		// your code e.g Kick(playerid);
		}
		else if(strfind(inputtext, "B", false, length)) //checks if the password contains letter "B" at last
		{
		// your code e.g Kick(playerid);
		}
		else if(strfind(inputtext, "C", false, length)) //checks if the password contains letter "C" at last
		{
		// your code e.g Kick(playerid);
		}
		//.... so on
	}
}
Ask if you need more help, and don't forget to rep++ me - Regards Noob Programmer Akbaig
Reply
#6

Here's a solution, don't use others gamemodes, learn to "build" one.
Thats simply a backdoor the developer added, And I kudos him on that, he did a well job protecting his assets.
Being a server owner is not an achievement, any 12y/o with access to his daddy's credit-card can do it, but learning and writing code is quite a nice achievement.
Reply
#7

I share the same opinion with you, but making actual gamemode from scratch is verry heavy on time, so i just better download some already done gamemode and just manipulate stuff through filterscripts.

Anyways, thanks Akbaig for help, it worked -> REP + as i promised!
Reply
#8

Hey guys, we just tested it and a problem has occured. When player writes anything to the dialog and confirms it (he uses it) it kicks him out.

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) // dialogid 1
{
    if(dialogid == 1)
	{
		if(response)
		{
			new length;
			length = strlen(inputtext);
			if(strfind(inputtext, "A", false, length))
			{
			    ShowPlayerDialog(playerid, 4577877, DIALOG_STYLE_MSGBOX, "Ochrana", "{FFFFFF}Kvůli ochraně serveru, heslo nemůћe obsahovat velkб pнsmena.", "Ok", "");
				SetTimerEx("KickPlayer",100,false,"i",playerid);
			}
			else if(strfind(inputtext, "B", false, length))
			{
			    ShowPlayerDialog(playerid, 4577877, DIALOG_STYLE_MSGBOX, "Ochrana", "{FFFFFF}Kvůli ochraně serveru, heslo nemůћe obsahovat velkб pнsmena.", "Ok", "");
				SetTimerEx("KickPlayer",100,false,"i",playerid);
			}
			else if(strfind(inputtext, "C", false, length))
			{
			    ShowPlayerDialog(playerid, 4577877, DIALOG_STYLE_MSGBOX, "Ochrana", "{FFFFFF}Kvůli ochraně serveru, heslo nemůћe obsahovat velkб pнsmena.", "Ok", "");
				SetTimerEx("KickPlayer",100,false,"i",playerid);
			}
			else if(strfind(inputtext, "D", false, length))
			{
			    ShowPlayerDialog(playerid, 4577877, DIALOG_STYLE_MSGBOX, "Ochrana", "{FFFFFF}Kvůli ochraně serveru, heslo nemůћe obsahovat velkб pнsmena.", "Ok", "");
				SetTimerEx("KickPlayer",100,false,"i",playerid);
			}
			else if(strfind(inputtext, "E", false, length))
			{
			    ShowPlayerDialog(playerid, 4577877, DIALOG_STYLE_MSGBOX, "Ochrana", "{FFFFFF}Kvůli ochraně serveru, heslo nemůћe obsahovat velkб pнsmena.", "Ok", "");
				SetTimerEx("KickPlayer",100,false,"i",playerid);
			}
			else if(strfind(inputtext, "F", false, length))
			{
			    ShowPlayerDialog(playerid, 4577877, DIALOG_STYLE_MSGBOX, "Ochrana", "{FFFFFF}Kvůli ochraně serveru, heslo nemůћe obsahovat velkб pнsmena.", "Ok", "");
				SetTimerEx("KickPlayer",100,false,"i",playerid);
			}
		}
	}
	return 1;
}
Reply
#9

why would you kick a player for typing a or b or c or d or e or f? :O
Reply
#10

Oh, someone cant read? Read the main post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)