stock CriarArquivoLevels(playerid) //Cria o arquivo em Scriptfiles/Levels
{
new formatted[40],Nomesz[25];
GetPlayerName(playerid,Nomesz,25);
format(formatted,40,"Levels/%s.subzero",Nomesz);
if(fexist(formatted)) return 0;
new File:SubZero=fopen(formatted,io_write);
fwrite(SubZero,"0");
fclose(SubZero);
return 1;
}
stock PegarLevel(playerid) //Retorna o level do player
{
new Nomesz[25],strp[10],formatted[40];
GetPlayerName(playerid,Nomesz,25);
format(formatted,40,"Levels/%s.subzero",Nomesz);
if(fexist(formatted)) return 0;
new File:SubZero=fopen(formatted,io_read);
fread(SubZero,strp);
fclose(SubZero);
return strval(strp);
}
stock AddLevel(playerid) //Adiciona mais um level ao player
{
new Nomesz[25],strp[10],formatted[40];
GetPlayerName(playerid,Nomesz,25);
format(formatted,40,"Levels/%s.subzero",Nomesz);
if(fexist(formatted)) return 0;
new File:SubZero=fopen(formatted,io_read);
fread(SubZero,strp);
fclose(SubZero);
new level=strval(strp);
new StakLine[10];
format(StakLine,10,"%d",level+1);
new File:SubZero2=fopen(formatted,io_write);
fwrite(SubZero2,StakLine);
fclose(SubZero2);
return 1;
}