Skip to content

Instantly share code, notes, and snippets.

@Misiur

Misiur/test.pwn Secret

Created July 14, 2016 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Misiur/0fe1989a16fe82de2034d766b0960015 to your computer and use it in GitHub Desktop.
Save Misiur/0fe1989a16fe82de2034d766b0960015 to your computer and use it in GitHub Desktop.
#include <a_samp>
#define _inc_a_samp
#include <YSI\y_ini>
enum E_TEST
{
E_TEST_INT,
E_TEST_STRING[24]
}
static Test[1][E_TEST];
main () {
}
public OnGameModeInit()
{
strcpy(Test[0][E_TEST_STRING], "Hello world", 24);
Test[0][E_TEST_INT] = 666;
printf("%s %d", Test[0][E_TEST_STRING], Test[0][E_TEST_INT]);
SaveTest();
strcpy(Test[0][E_TEST_STRING], "Howdy", 24);
Test[0][E_TEST_INT] = 13;
printf("%s %d", Test[0][E_TEST_STRING], Test[0][E_TEST_INT]);
INI_ParseFile("test.ini", "LoadTest");
printf("%s %d", Test[0][E_TEST_STRING], Test[0][E_TEST_INT]);
return 1;
}
forward LoadTest(name[], value[]);
public LoadTest(name[], value[]) {
INI_String("foobar", Test[0][E_TEST_STRING], 24);
INI_Int("bar", Test[0][E_TEST_INT]);
return 1;
}
SaveTest() {
new INI:dFile = INI_Open("test.ini");
INI_WriteString(dFile, "foobar", Test[0][E_TEST_STRING]);
INI_WriteInt(dFile, "bar", Test[0][E_TEST_INT]);
INI_Close(dFile);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment