Hi all it's me again.
I'm have a big problem.
I'm don't know, how save and load....
In my plugin, i'm load others plugin i.e. i use native to register achievement.
All is good. just save and load...
This is my save and load :
LOAD:
PHP Code:
public WczytajI(id)
{
new nick[33], dane[500]
get_user_name(id, nick, 32)
WczytajDane(plikI, nick, dane, 499)
remove_quotes(dane)
new wartosc[MAX_ACHIEVEMENTS+1][15]
explode(dane, ' ', wartosc, MAX_ACHIEVEMENTS+1, 14)
for(new i = 0; i <= liczba_achI; i++)
{
if(i == 0)
status_achI[id][1] = str_to_num(wartosc[i])
else if(i != 0)
status_achI[id][i+1] = str_to_num(wartosc[i+1])
}
for(new i = 0; i <= liczba_achI; i++)
{
if(i == 0)
postep_achI[id][1] = str_to_num(wartosc[i+1])
else if(i != 0)
postep_achI[id][i+1] = str_to_num(wartosc[i+2]);
}
}
SAVE:
PHP Code:
public ZapiszI(id)
{
new nick[33], dane[500], szTemp[25]
get_user_name(id, nick, 32)
for(new i = 1; i <= liczba_achI; i++)
{
formatex(szTemp, 24, "%d %d ", status_achI[id][i], postep_achI[id][i])
add(dane, 499, szTemp)
}
ZapiszDane(plikI, nick, dane)
}
I'm think save its working...
i'm use my save and load engine "savev"
this is .inc :
PHP Code:
#if defined _Save_included
#endinput
#endif
#include <amxmodx>
// save path
new sciezka[] = "addons/amxmodx/Zapis_v2" // Folder zapisywanych plikow
/* Save function */
public ZapiszDane(const file[], const key[], const data[])
{
new ominac
new c[1024], sciezka_[128], arg1[64], tekst[500], len;
formatex(sciezka_, 127, "%s/%s", sciezka, file);
formatex(c, 1023, "^"%s^" ^"%s^"", key, data);
if(!dir_exists(sciezka))
mkdir(sciezka);
if(!file_exists(sciezka_))
write_file(sciezka_, "", 0);
for(new i; read_file(sciezka_, i, tekst, 499, len);i++)
{
parse(tekst, arg1, 63);
if(equal(key, arg1, strlen(arg1)))
{
write_file(sciezka_, c, i);
ominac++
}
else
continue;
}
if(!ominac)
write_file(sciezka_, c, -1);
ominac = 0
}
/* Load Function */
public WczytajDane(const file[], const key[], data[], len)
{
new tekst[1101], len, sciezka_[128];
new arg1[64], arg2[1024];
formatex(sciezka_, 127, "%s/%s", sciezka, file)
if(!file_exists(sciezka_))
return PLUGIN_CONTINUE
for(new i; read_file(sciezka_, i, tekst, 1100, len);i++)
{
parse(tekst, arg1, 63, arg2, 1023);
if(equal(key, arg1, strlen(arg1)))
copy(data, len, arg2);
else
continue;
}
return PLUGIN_CONTINUE
}
/* Deleted Function */
public UsunDane(const file[], const key[])
{
new tekst[1101], len, sciezka_[128];
new arg1[64], arg2[1024];
formatex(sciezka_, 127, "%s/%s", sciezka, file)
if(!file_exists(sciezka_))
return PLUGIN_CONTINUE
for(new i; read_file(sciezka_, i, tekst, 1100, len);i++)
{
parse(tekst, arg1, 63, arg2, 1023);
if(equal(key, arg1, strlen(arg1)))
write_file(sciezka_, "", i);
else
continue;
}
return PLUGIN_CONTINUE
}
this is result of save
"STRIKER--McPr0

" "1 3 1 0 1 0 1 0 1 3 1 0 "
"1 3 1 0 1 0 1 0 1 3 1 0 "
first number '1' is status of one achievement, second number this is '3' is progress of achievement...
third number '1' is status of two achievement ...
I'm dont know how many is achievement becouse one plugin, one achievement

so i use 'add' function...
function 'explode' by DarkGL.
PHP Code:
stock explode(const string[],const character,output[][],const maxs,const maxlen){
new iDo = 0;
new len = strlen(string);
new oLen = 0;
do
{
oLen += (1+copyc(output[iDo++],maxlen,string[oLen],character))
}
while(oLen < len && iDo < maxs)
}
So... Please Help me!!!