Advertisement
LePtitClown

Problème de vérification d'IP

May 1st, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.15 KB | None | 0 0
  1. stockerip(playerid)// on sauvegarder toutes les IP
  2. {
  3.     new tmpp[32],string[256], tmp[256];
  4.     GetPlayerIp(playerid, tmpp, 32);
  5.     new File:file = fopen("fichier.txt", io_read);
  6.     while(fread(file, string)) //reads the file line-by-line
  7.     {
  8.         if(strcmp(string, tmpp, true) == 0)
  9.         {
  10.             fclose (file);
  11.         }
  12.         else
  13.         {
  14.         format(tmp, sizeof(tmp), "%s\r\n",tmpp);
  15.          fwrite(file, tmp);
  16.           fclose(file);
  17.     }
  18.     }
  19.  
  20. }
  21.  
  22. verifip(playerid)// On vérifie si cette IP est présente dans le fichier texte
  23. {
  24.     new tmpp[32],string[256], tmp[256];
  25.     GetPlayerIp(playerid, tmpp, 32);
  26.     new File:file = fopen("fichier.txt", io_read);
  27.     while(fread(file, string)) //reads the file line-by-line
  28.     {
  29.         if(strcmp(string, tmpp, true) == 0)
  30.         {
  31.                 fclose (file);
  32.             format(string1, sizeof(string1), "[ADMIN] %s (ID: %d) a été kické pour double compte", initialname[playerid],playerid);
  33.             SendClientMessageToAll(COLOR_INFO, string1);
  34.         Kick(playerid);
  35.         }
  36.         else
  37.         {
  38.         format(tmp, sizeof(tmp), "%s\r\n",tmpp);
  39.         fwrite(file, tmp);
  40.         fclose(file);
  41.     }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement