Jump to content

Recommended Posts

Posted

Presupun ca te referi la dialog-uri. Poti folosi functia strfind sa verifici daca '%' e in text-ul introdus in dialog. Daca e introdus, returnezi 0 ca sa nu mai continue actiunea.

Posted

if(strfind("%", "you", false) != -0)

 

Presupun ca te referi la dialog-uri. Poti folosi functia strfind sa verifici daca '%' e in text-ul introdus in dialog. Daca e introdus, returnezi 0 ca sa nu mai continue actiunea.


Presupun ca te referi la dialog-uri. Poti folosi functia strfind sa verifici daca '%' e in text-ul introdus in dialog. Daca e introdus, returnezi 0 ca sa nu mai continue actiunea.

?

Posted

Presupun ca te referi la dialog-uri. Poti folosi functia strfind sa verifici daca '%' e in text-ul introdus in dialog. Daca e introdus, returnezi 0 ca sa nu mai continue actiunea.

 

Poți să îi da-i lui tot ce are nevoie (linia etc) dacă are are variable le schimbă nu este o problemă.

Cum să adaugi o protecție de tip ANTI - SQL - INJECTION 
Pasul 1: 

Creeam un static, mergem sus de tot în gamemode după ultimul #include și adăugăm acest static:

static const antisqlinjection[][] = {"'","#","`","%s","%d","%f" };

Pasul 2:

Mergem la OnDialogResponse si adăugăm această funcție:

for(new i; i < sizeof(antisqlinjection); i++) {if(strfind(inputtext, antisqlinjection, true) != -1){ SCM(playerid, -1, "Nu sunt permise asemenea caractere.");return 1;} }Atentie: Aceasta functie trebuie adaugata imediat dupa linia: OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

T/C.

  • 4 months later...
Posted


if(!isnull(inputtext))
for(new strPos; inputtext[strPos] > 0; strPos++)
if(inputtext[strPos] == '%')
inputtext[strPos] = '\0';

Ceva mai simplu.

 

Posted

Sau asa. E cel mai simplu.

 

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

       if(strfind(inputtext, "%", true) != -1) return SendClientMessage(playerid,0xFFBD3939FF, "{BD3939}Nu poti pica serverul.");

 

.........

Posted

if(strfind("%", "you", false) != -0)

 

?

 

  • Uite aici adaugi asta in gm, iar cand acel player va incerca sa flodeze serverul prin acea metoda va primi kick de la server automat.

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{
    new vehicleid = GetPlayerVehicleID(playerid);
new sendername[25];
new string[300];
if(strfind(inputtext, "%", true) != -1)
{
new flooder[MAX_PLAYER_NAME];
new string10[100];
GetPlayerName(playerid, flooder, sizeof(flooder));
format(string10, sizeof(string10), "{f03337}Warning: %s(%d) tryes to flood server with dialog method.", flooder, playerid);
ABroadCast(COLOR_RED,string10,1);
SendClientMessage(playerid, COLOR_WHITE, "You have been kicked because you tried to flood server.");
KickEx(playerid);
return 1;
}

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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

By using this site, you agree to our Terms of Use. 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.

moduri samp