Marian Z. Ogrezeanu Posted February 2, 2017 Posted February 2, 2017 Vreau sa fac o comanda care restrictioneaza % , pentru ca iau flood de multe ori. Ma ajuta cineva? Quote
Zooky. Posted February 2, 2017 Posted February 2, 2017 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. Quote
Marian Z. Ogrezeanu Posted February 2, 2017 Author Posted February 2, 2017 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. ? Quote
Arnold Official Posted February 2, 2017 Posted February 2, 2017 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. Quote
Size Posted June 11, 2017 Posted June 11, 2017 if(!isnull(inputtext)) for(new strPos; inputtext[strPos] > 0; strPos++) if(inputtext[strPos] == '%') inputtext[strPos] = '\0'; Ceva mai simplu. Quote
SpRiTe97 Posted June 14, 2017 Posted June 14, 2017 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."); ......... Quote
DraQ3U Posted June 21, 2017 Posted June 21, 2017 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; } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.