[Ajuda] Sistema de Level
#1

Gente, alguйm poderia me ajudar ? o cуdigo atual funciona perfeitamente, porйm estou com problemas em adaptar ele, gostaria de incluir uma funзгo nele, a do EXP 5 exp pra chegar a um level, e dar 1 exp a cada 10min ....
Porйm ainda nгo tenho a funзгo de EXP, ele sу upa a cada 1 hora de jogo, mas gostaria de incluir o sistema de exp junto, alguйm poderia ajudar ?

Код:
#include <a_samp>
#include <DOF2>

#define LEVEL                  "Level/%s.ini" 
#define SEGUNDOSLEVEL          3600 /

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);
  
}
OBS NГO TA UPANDO KSKSK quando aparece o LEVEL UP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)