toribio

toribio

Feb 27th, 2009
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. public OnFilterScriptInit()
  4. {
  5.     new string[256], destino[256];
  6.     string = "<grana=\"banco\">50000</grana><jogador>Toribio</jogador>"; //faz de conta que isso estava no arquivo
  7.     PegarValorXML(destino, string, "jogador");
  8.     printf("--%s--", destino);
  9.     PegarValorXML(destino, string, "grana");
  10.     printf("--%s--", destino);
  11.     return 0;
  12. }
  13.  
  14. stock PegarValorXML(dest[], const source[], const key[], maxlenght=sizeof dest)
  15. {
  16.     new keymid[256];
  17.     format(keymid, sizeof keymid, "<%s", key);
  18.     if(strfind(source, keymid, true) != -1)
  19.     {
  20.         new tmp[256];
  21.         strmid(tmp, source, strfind(source, keymid, true), strlen(source));
  22.         new a = strfind(tmp, ">", true) + 1;
  23.         format(keymid, sizeof keymid, "</%s>", key);
  24.         new b = strfind(tmp, keymid, true);
  25.         strmid(dest, tmp, a, b, maxlenght);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment