Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnFilterScriptInit()
- {
- new string[256], destino[256];
- string = "<grana=\"banco\">50000</grana><jogador>Toribio</jogador>"; //faz de conta que isso estava no arquivo
- PegarValorXML(destino, string, "jogador");
- printf("--%s--", destino);
- PegarValorXML(destino, string, "grana");
- printf("--%s--", destino);
- return 0;
- }
- stock PegarValorXML(dest[], const source[], const key[], maxlenght=sizeof dest)
- {
- new keymid[256];
- format(keymid, sizeof keymid, "<%s", key);
- if(strfind(source, keymid, true) != -1)
- {
- new tmp[256];
- strmid(tmp, source, strfind(source, keymid, true), strlen(source));
- new a = strfind(tmp, ">", true) + 1;
- format(keymid, sizeof keymid, "</%s>", key);
- new b = strfind(tmp, keymid, true);
- strmid(dest, tmp, a, b, maxlenght);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment