SA-MP Forums Archive
Dialog help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog help (/showthread.php?tid=598107)



Dialog help - _GHT_MarK445 - 08.01.2016

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.


Re: Dialog help - Elegy - 09.01.2016

I don't understand,explain more please


Re: Dialog help - fuckingcruse - 09.01.2016

Show us codes buddy..


Re: Dialog help - _GHT_MarK445 - 09.01.2016

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.


Re: Dialog help - Akbaig - 09.01.2016

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


Re: Dialog help - PrO.GameR - 09.01.2016

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.


Re: Dialog help - _GHT_MarK445 - 11.01.2016

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!


Re: Dialog help - _GHT_MarK445 - 14.01.2016

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;
}



Re: Dialog help - Eth - 14.01.2016

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


Re: Dialog help - _GHT_MarK445 - 14.01.2016

Oh, someone cant read? Read the main post.