[Ajuda] Sistema EXP
#1

Explicaзгo: Bom meu sistema de exp tб com um problema que tipo quando upo a progress bar nгo reinicia do 0 й tambйm tipo se eu to com 4 de exp й precisso de 5 xp pra upar ai vo mata um player que no caso cada kill vale 4exp ai eu mato й upo mais nгo reinicia a progress й tambйm n da + 3 de exp pq usei so 1 de exp pra bater 5/5 cade os outros 3 ? devia reinicia a barra da progress + os 3 xp que ganhei por que so usei 1 de exp pra upa.

PHP код:
enum ZXP
{
    
pEXP
};
// ~~> Config. Experience
new Text:TDXP[1];
new 
Point[MAX_PLAYERS][ZXP];
new 
Bar:BARXP[MAX_PLAYERS];
// ~~> Forwards
forward GetValueXP(playerid);
forward Experience(playeridvalue);
public 
OnGameModeInit()
{
SetTimer("Experience"1000true);
SetTimer("UpdateBar"1000true);
// ~~> Contagem de XP
    
TDXP[0] = TextDrawCreate(575.50793457.164325"1000/9000");
    
TextDrawAlignment(TDXP[0], 2);
    
TextDrawBackgroundColor(TDXP[0], 16);
    
TextDrawFont(TDXP[0], 2);
    
TextDrawLetterSize(TDXP[0], 0.1501560.595465);
    
TextDrawColor(TDXP[0], 0xCD0000FF);
    
TextDrawSetOutline(TDXP[0], 1);
    
TextDrawSetProportional(TDXP[0], 1);
    
TextDrawSetSelectable(TDXP[0], 0);
return 
true;
}
public 
OnPlayerRequestClass(playeridclassid)
{
Experience(playerid0);
return 
1;
}
public 
OnPlayerSpawn(playerid)
{
// ~~ EXP
    
Experience(playerid0);
    
BARXP[playerid] = CreateProgressBar(548.0058.0057.504.19, -492364374100.0);
    
TextDrawShowForPlayer(playeridTDXP[0]);
    
ShowProgressBarForPlayer(playeridBARXP[playerid]);
return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
Player[playerid][Died]++;
    
Player[killerid][Killed]++;
    
SendDeathMessage(killeridplayeridreason);
    if(
killerid != INVALID_PLAYER_ID)
    {
        if(
IsPlayerConnected(killerid))
        {
            if(
Player[playerid][pXOne] && Player[killerid][pXOne])
            {
                
Player[playerid][pXOne] = false;
                
Player[killerid][pXOne] = false;
                
SetPlayerVirtualWorld(playerid0);
                
SetPlayerVirtualWorld(killerid0);
                
SetPlayerInterior(playerid0);
                
SetPlayerInterior(killerid0);
                
SendFormattedMessage(killeridCOLOR_TEAL""TAG_SERVER" Vocк venceu o player %s no X1."GetName(playerid));
                
SendFormattedMessage(playeridCOLOR_TEAL""TAG_SERVER" Vocк perdeu para o player %s no X1."GetName(killerid));
                
Player[killerid][XOneWin]++;
                
SpawnPlayer(killerid);
                
SpawnPlayer(playerid);
            }
            
Experience(killerid4);
            
GivePlayerMoney(killerid100);
            
PlayerPlaySound(killerid10570.00.00.0);
            
GameTextForPlayer(killerid"DOUBLE XP!!~n~VOCE GANHOU 4 XP!!!!"30003);
            
UpdateBar(killerid);
        }
    }
    return 
1;
}
public 
GetValueXP(playerid)
{
    static 
value;
    if(
Player[playerid][Score] == 0)
    
value 4;
    else
    
value Player[playerid][Score] * 8;
    return 
value;
}
//==============================================================================
public Experience(playeridvalue)
{
    
Point[playerid][pEXP] += value;
    if(
Point[playerid][pEXP] >= GetValueXP(playerid))
    {
        
Point[playerid][pEXP] = 0;
        
Player[playerid][Score] += 1;
        
SetPlayerScore(playeridPlayer[playerid][Score]);
        
GameTextForPlayer(playerid"~y~VOCE UPOU DE LEVEL!!!!"30003);
        
UpdateBar(playerid);
        
Salvar_Conta(playerid);
        return 
1;
    }
    
UpdateBar(playerid);
    return 
1;
}
//==============================================================================
forward UpdateBar(playerid);
public 
UpdateBar(playerid)
{
    
SetProgressBarValue(BARXP[playerid], Point[playerid][pEXP]);
    
SetProgressBarMaxValue(BARXP[playerid], GetValueXP(playerid));
    
UpdateProgressBar(BARXP[playerid], playerid);
    new 
str[100];
    
format(strsizeof(str), "%d/%d"Point[playerid][pEXP], GetValueXP(playerid));
    
TextDrawSetString(TDXP[0], str);
    return 
1;

Alguйm ajuda.
Reply


Messages In This Thread
Sistema EXP - by BrGabrielBr - 19.03.2018, 15:42
Re: Sistema EXP - by FerrariL - 19.03.2018, 15:57
Re: Sistema EXP - by BrGabrielBr - 19.03.2018, 16:24
Re: Sistema EXP - by Don_Speed - 20.03.2018, 14:45
Re: Sistema EXP - by BrGabrielBr - 20.03.2018, 18:12
Re: Sistema EXP - by Don_Speed - 20.03.2018, 19:09
Re: Sistema EXP - by Injury - 20.03.2018, 19:42
Re: Sistema EXP - by BrGabrielBr - 20.03.2018, 20:09

Forum Jump:


Users browsing this thread: 2 Guest(s)