Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <DOF2>
- #define LEVEL "Level/%s.ini" //PASTA PARA SALVAR O LEVEL.
- #define SEGUNDOSLEVEL 3600 //TROQUE PARA OS SEGUNDOS DESEJADOS, 3600 SEGUNDOS = 1 HORA
- enum Info
- {
- pSegundos,
- pLevel
- };
- new PlayerInfo[MAX_PLAYERS][Info];
- new segundos;
- public OnFilterScriptInit()
- {
- print("\n-----------------CARREGADO-----------------");
- print(" Sistema de Level UP/HorasJogadas/Salario");
- print("----------------LucasTotola----------------\n");
- segundos = SetTimer("SegundoaMais",1000,1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n---------------DESCARREGADO----------------");
- print(" Sistema de Level UP/HorasJogadas/Salario");
- print("----------------LucasTotola----------------\n");
- KillTimer(segundos);
- DOF2_Exit();
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- new arquivo[34], playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- format(arquivo, sizeof(arquivo), LEVEL, playername);
- if(DOF2_FileExists(arquivo))
- {
- DOF2_SetInt(arquivo, "Segundos", PlayerInfo[playerid][pSegundos]);
- DOF2_SetInt(arquivo, "Level", PlayerInfo[playerid][pLevel]);
- DOF2_SaveFile();
- }
- else
- {
- DOF2_CreateFile(arquivo);
- DOF2_SetInt(arquivo, "Segundos", PlayerInfo[playerid][pSegundos]);
- DOF2_SetInt(arquivo, "Level", PlayerInfo[playerid][pLevel]);
- DOF2_SaveFile();
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new arquivo[34], playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- format(arquivo, sizeof(arquivo), LEVEL, playername);
- PlayerInfo[playerid][pSegundos] = DOF2_GetInt(arquivo, "Segundos");
- PlayerInfo[playerid][pLevel] = DOF2_GetInt(arquivo, "Level");
- return 1;
- }
- forward SegundoaMais();
- public SegundoaMais()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- PlayerInfo[i][pSegundos] ++;
- if(PlayerInfo[i][pSegundos] >= SEGUNDOSLEVEL)
- {
- PlayerInfo[i][pSegundos] = 0;
- LevelUP(i);
- }
- }
- return 1;
- }
- LevelUP(playerid)
- {
- PlayerInfo[playerid][pLevel] ++;
- GivePlayerMoney(playerid, 50000);
- GameTextForPlayer(playerid, "~w~Level ~p~UP", 2000, 1);
- // COLOQUE AQUI AS FUNÇÕES QUE DESEJA NO SEU "LEVEL UP"
- }
Advertisement
Add Comment
Please, Sign In to add comment