Jump to content

Cum sa nu iti pice serverul prin /report /changepass sau alte dialoguri.


Reset

Recommended Posts

Salut,eu sunt nou pe aceasta comunitate,si unii nu stiu cum sa faca un anti-flood la comanda /report sau alte dialoguri.

Deci sa incepem.

Mergem la  public OnDialogResponse

si scriem acest cod
 

if(strfind(inputtext, "%", true) != -1)
	{
		SendClientMessage(playerid, COLOR_GENANNOUNCE, "SERVER: Invalid dialog input. You can't use %%.");
		ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "Invalid dialog input", "Invalid dialog input", "OK", "Exit");
		return 1;
	}

Daca puneti asta nu va mai poate pica nimeni prin comanda /report /changepass sau unele comenzi,care mai au dialoguri.

Sper ca v-a placut,astept hate din partea celor care se dau marii.

Edited by RebornAdv
Am gresit ceva.
  • Upvote 1

mai tare e bigzone

Link to comment
Share on other sites

47 minutes ago, LeonardPWN said:

Metode antice

Poti da si un exemplu de metoda mai performanta daca tot ii strigi baiatului te rog? Multumesc

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

La 3/21/2018 la 20:55, Mister a spus:

Poti da si un exemplu de metoda mai performanta daca tot ii strigi baiatului te rog? Multumesc

On : Folositor :D 

 

Off :A tacut din gura pe vecie :)) 

Edited by Goad
Link to comment
Share on other sites

  • 10 months later...
Acum 51 minute, Flint331 a spus:

Nu cumva e mai bun asta ?


 	if(strlen(inputtext) >= 1) {
		if(strfind(inputtext, "%", true) != -1 || strfind(inputtext, "`", true) != -1 || strfind(inputtext, "'", true) != -1) return SCM(playerid, COLOR_LIGHTBLUE, "Caractere invalide!");
    }

 

for (new i = 0, l = strlen(inputtext); i < l; i ++)
	{
		if (inputtext[i] == '%')
		{
			inputtext[i] = '#';
		}
	}

Mult mai buna. apropo, daca nu vrei sa priemsti SQL Injection prin folosirea de apostrof etc mai bine protejeaza query cu mysql_escape_string sau %e in mysql_format

Link to comment
Share on other sites

mai bn faci asa
 

	new bool:anuntat = false;
    if(!isnull(inputtext))
    {
        for(new _pos; inputtext[_pos] > 0; _pos++)
        {
            if(inputtext[_pos] == '%')
            {
                inputtext[_pos] = '#';
                if(!anuntat) {
                    SendClientMessage(playerid, -1, "Info: {FFFFFF}Au fost detectate caractere invalide! Acestea au fost automat eliminate!");
                    anuntat = true;
                }
            }
        }
    }

mult mai ok.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.