[Pedido] Sistema de level
#2

Peguei esse sistema e dei uma modificada pro jeito que vocк quer..
os crйditos do criador

Sistema de Level UP/HorasJogadas/Salario
----------------LucasTotola---------------

PHP код:
#include <a_samp>
#include <DOF2>
#define LEVEL                  "Level/%s.ini"
#define SEGUNDOSLEVEL          600
enum Info
{
    
pSegundos,
    
pLevel,
    
pExp
};
new 
PlayerInfo[MAX_PLAYERS][Info];
new 
segundos;
public 
OnFilterScriptInit()
{
    
segundos SetTimer("SegundoaMais",1000,1);
    return 
1;
}
public 
OnFilterScriptExit()
{
    
KillTimer(segundos);
    
DOF2_Exit();
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
    new 
arquivo[34], playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
format(arquivosizeof(arquivo), LEVELplayername);
    if(
DOF2_FileExists(arquivo))
    {
        
DOF2_SetInt(arquivo"Segundos"PlayerInfo[playerid][pSegundos]);
        
DOF2_SetInt(arquivo"Level"PlayerInfo[playerid][pLevel]);
        
DOF2_SetInt(arquivo"Exp"PlayerInfo[playerid][pExp]);
        
DOF2_SaveFile();
    }
    else
    {
        
DOF2_CreateFile(arquivo);
        
DOF2_SetInt(arquivo"Segundos"PlayerInfo[playerid][pSegundos]);
        
DOF2_SetInt(arquivo"Level"PlayerInfo[playerid][pLevel]);
        
DOF2_SetInt(arquivo"Exp"PlayerInfo[playerid][pExp]);
        
DOF2_SaveFile();
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    new 
arquivo[34], playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
format(arquivosizeof(arquivo), LEVELplayername);
    
PlayerInfo[playerid][pSegundos] = DOF2_GetInt(arquivo"Segundos");
    
PlayerInfo[playerid][pLevel] = DOF2_GetInt(arquivo"Level");
    
PlayerInfo[playerid][pExp] = DOF2_GetInt(arquivo"Exp");
    return 
1;
}
forward SegundoaMais();
public 
SegundoaMais()
{
    for(new 
0MAX_PLAYERSi++)
    {
        
PlayerInfo[i][pSegundos] ++;
        if(
PlayerInfo[i][pSegundos] >= SEGUNDOSLEVEL)
        {
            
PlayerInfo[i][pSegundos] = 0;
            
LevelUP(i);
        }
    }
    return 
1;
}
LevelUP(playerid)
{
    
PlayerInfo[playerid][pLevel] +=1;
    if(
PlayerInfo[playerid][pLevel] >= 5)
    {
        
PlayerInfo[playerid][pLevel] = 0;
        
PlayerInfo[playerid][pExp] += 1;
        
GameTextForPlayer(playerid"~w~Level ~p~UP"20001);
    }
    
GameTextForPlayer(playerid"~w~+1 ~p~EXP"15001);
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/meulevel"cmdtext) == 0)
    {
        new 
string[256];
        
format(stringsizeof(string), "Seu level: %i"PlayerInfo[playerid][pExp]);
        
SendClientMessage(playerid0xAF0000FFstring);
        return 
1;
    }
    return 
0;

Reply


Messages In This Thread
Sistema de level - by daniel079 - 12.09.2015, 18:39
Re: Sistema de LEVEL - by 99fe3rnando - 12.09.2015, 19:39
Re: Sistema de LEVEL - by Lуs - 12.09.2015, 19:43
Re: Sistema de level - by daniel079 - 12.09.2015, 20:58
Re: Sistema de level - by Lуs - 12.09.2015, 21:03
Re: Sistema de level - by daniel079 - 13.09.2015, 00:01
Re: Sistema de level - by Lуs - 13.09.2015, 00:05
Re: Sistema de level - by daniel079 - 13.09.2015, 00:09
Re: Sistema de level - by 99fe3rnando - 13.09.2015, 00:50

Forum Jump:


Users browsing this thread: 1 Guest(s)