#include < a_samp >
#include < dini >
#undef MAX_PLAYERS
#define MAX_PLAYERS 30 // slotok száma
new ora[ MAX_PLAYERS ];
new perc[ MAX_PLAYERS ];
new mperc[ MAX_PLAYERS ];
new timer;
forward oraa();
public OnFilterScriptInit( )
{
timer = SetTimer( \"oraa\",1000,true );
return 1;
}
public OnFilterScriptExit( )
{
KillTimer( timer );
return 1;
}
public oraa( )
{
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
mperc[ i ]++;
if(mperc == 60)
{
perc[ i ] ++;
mperc[ i ] = 0;
}
if(perc[ i ] == 60)
{
ora[ i ] ++;
perc[ i ] = 0;
SendClientMessage(i,-1,\"Óraugrás.\");
SetPlayerScore(i,GetPlayerScore(i)+1);
}
}
}
public OnPlayerConnect( playerid )
{
olvas( playerid );
return 1;
}
public OnPlayerDisconnect( playerid )
{
ment( playerid );
return 1;
}
stock ment( id )
{
new file[128];
new name[24];
GetPlayerName(id,name,24);
format(file,128,\"ora/%s.ini\",name);
if(fexist(file))
{
dini_IntSet(file,\"o\", ora[id]);
dini_IntSet(file,\"p\", perc[id]);
dini_IntSet(file,\"m\", mperc[id]);
}
}
stock olvas( id )
{
new file[128];
new name[24];
GetPlayerName(id,name,24);
format(file,128,\"ora/%s.ini\",name);
if(fexist(file))
{
ora[id] = dini_Int(file,\"o\");
perc[id] = dini_Int(file,\"p\");
mperc[id] = dini_Int(file,\"m\");
SetPlayerScore(id,dini_Int(file,\"o\"));
}
}