Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // h_INI - Simples, porém util :D
- // Include super facil de se usar,funções:
- // h_Open("diretorio\arquivo.ini(.txt,etc)");
- // h_Write("texto ou numero");
- // h_Read();
- // h_Close();
- #include a_samp
- #define MAX_STRING 128
- new bool:Open;
- new File: b;
- stock h_Open(const file[MAX_STRING])
- {
- if(Open == true) return 0;
- Open = true;
- b = fopen(file, io_readwrite);
- for(new i; i < 1; i++) if(b) continue;
- return 1;
- }
- stock h_Write(const string[MAX_STRING])
- {
- if(Open == false) return 0;
- new str[128];
- format(str,sizeof(str),"%s \r",string);
- fwrite(b,str);
- return 1;
- }
- stock h_Read()
- {
- new str[128];
- fread(b,str);
- return str;
- }
- stock h_Close()
- {
- if(Open == false) return 0;
- fclose(b);
- Open = false;
- return 1;
- }
- /* TESTE DE VELOCIDADE E EXEMPLO: 1ms entre 0ms
- main()
- {
- new tick;
- tick=GetTickCount();
- h_Open("player.ini");
- h_Write("Byted bonito");
- h_Close();
- h_Open("player.info");
- printf("%s",h_Read());
- h_Close();
- printf("%d ms",GetTickCount()-tick);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment