[Ajuda] Sistema level nao salva
#1

PHP код:
forward upJean( );
public 
upJean( )
{
            foreach(
Playeri)
            {
            if(
PlayerInfo[i][pLogged] == 1){
               if(
AFK[i] == 0){
            if( 
PlayerInfo][ SegUP ] > )
            {
                
PlayerInfo][ SegUP ] --;
            }
            if( 
PlayerInfo][ SegUP ] == && PlayerInfo][ MinUP ] >= )
            {
                
PlayerInfo][ SegUP ] = 59;
                
PlayerInfo][ MinUP ] --;
            }
            if( 
PlayerInfo][ MinUP ] == && PlayerInfo][ SegUP ] == )
            {
                
PlayerInfo][ SegUP ] = 00;
                
PlayerInfo][ MinUP ] = 10;
                
GanharExp(i);
            }
            if( 
PlayerInfo][ Tem_RelogioUP ] == )
            {
            
formatgStrsizeofgStr ), "~w~+UP~b~: ~w~%02d~b~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
             
TextDrawSetStringTextLevelUP], gStr );
            if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+UP~b~: ~w~%02d~b~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~y~UP: ~w~%02d~y~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~r~UP: ~w~%02d~r~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~g~UP: ~w~%02d~g~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~p~UP: ~w~%02d~p~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~b~UP: ~w~%02d~b~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~y~~h~UP: ~w~%02d~y~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~r~~h~UP: ~w~%02d~r~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~g~~h~UP: ~w~%02d~g~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == )
            {
                
formatgStrsizeofgStr ), "~w~+~p~~h~UP: ~w~%02d~p~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
            else if( 
PlayerInfo][ RelogioCor ] == 10 )
            {
                
formatgStrsizeofgStr ), "~w~+~b~~h~UP: ~w~%02d~b~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] );
                
TextDrawSetStringTextLevelUP], gStr );
            }
             }
           }
         }
       }
     }
forward GanharExp(i);
public 
GanharExp(i)
{
       new 
string[128];
    
format(filesizeof(file), PASTA_CONTASPlayerName(i));
    if(
IsPlayerConnected(i))
    {
      if(
AFK[i] == 0){
      {
    if(
PlayerInfo[i][pExpe] == 4)
    {
    
PlayerInfo[i][pLevel]++;
    
PlayerInfo[i][pExpe] = 0;
    
TempoLevelMinuto[i] = 10;
    
format(stringsizeof(string), "| UP | Vocк acaba de ganhar +1 level, somando um total de %d"PlayerInfo[i][pLevel]);
    
SendClientMessage(i0x00FF00AAstring);
    
PlayerPlaySound(i10570.00.010.0);
    
dini_IntSet(file"EXP"PlayerInfo[i][pExpe]);
    
dini_IntSet(file"Level"PlayerInfo[i][pLevel]);
    if(
dini_Int(file"Level") > dini_Int("RankL.ini""LRank1")){
    if(
strcmp(dini_Get("RankL.ini""Rank1"), PlayerName(i), true) == 0){
    
dini_IntSet("RankL.ini""LRank1"dini_Int(file"Level"));
    }else{
    
dini_Set("RankL.ini""Rank2"dini_Get("RankL.ini""Rank1"));
    
dini_IntSet("RankL.ini""LRank2"dini_Int("RankL.ini""LRank1"));
    
dini_Set("RankL.ini""Rank1"PlayerName(i));
    
dini_IntSet("RankL.ini""LRank1"dini_Int(file"Level"));
    }
    }else{
    if(
dini_Int(file"Level") > dini_Int("RankL.ini""LRank2")){
    if(
strcmp(dini_Get("RankL.ini""Rank2"), PlayerName(i), true) == 0){
    
dini_IntSet("RankL.ini""LRank2"dini_Int(file"Level"));
    }else{
    
dini_Set("RankL.ini""Rank3"dini_Get("RankL.ini""Rank2"));
    
dini_IntSet("RankL.ini""LRank3"dini_Int("RankL.ini""LRank2"));
    
dini_Set("RankL.ini""Rank2"PlayerName(i));
    
dini_IntSet("RankL.ini""LRank2"dini_Int(file"Level"));
    }
    }else{
    if(
dini_Int(file"Level") > dini_Int("RankL.ini""LRank3")){
    
dini_Set("RankL.ini""Rank3"PlayerName(i));
    
dini_IntSet("RankL.ini""LRank3"dini_Int(file"Level"));
    }
    }
    }
      
Salario(i);
    }
    else
    {
    
PlayerInfo[i][pExpe]++;
    
TempoLevelMinuto[i] = 10;
    
format(stringsizeof(string), "| EXP | Vocк acaba de ganhar +1 ponto de experiкncia (%d/5)"PlayerInfo[i][pExpe]);
    
SendClientMessage(i0x00FF00AAstring);
    
PlayerPlaySound(i10570.00.010.0);
    
dini_IntSet(file"EXP"PlayerInfo[i][pExpe]);
    }
     }
    }
    }
    return 
1;

Porem o sistema de exp e leveu esta normal e notei uma coisa que nao salva o MinUP nem SegUP podem me ajudar? estou desesperado


# EDIT

Qnd relogar ou reniciar o sv aumenta 1 lv nao esta salvamndo o minup nem segup help me ;-;
Reply
#2

Esse cуdigo ta uma bagunзa,vocк esta salvando os dados quando o player desconecta ?
Reply
#3

Os dado da na boa o problema e o level que nao salva os EXP's
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=234691
Reply
#5

Um switch seria bom nesse cуdigo.
Reply
#6

Nunca nem vi switch pds me ajuda ilanz?
Reply
#7

Esta ai :
PHP код:
forward upJean( ); 
public 
upJean( ) 

    foreach(
Playeri
    { 
        if(
PlayerInfo[i][pLogged] == 1)
        { 
            if(
AFK[i] == 0)
            { 
                if( 
PlayerInfo][ SegUP ] > 
                { 
                    
PlayerInfo][ SegUP ] --; 
                } 
                if( 
PlayerInfo][ SegUP ] == && PlayerInfo][ MinUP ] >= 
                { 
                    
PlayerInfo][ SegUP ] = 59
                    
PlayerInfo][ MinUP ] --; 
                } 
                if( 
PlayerInfo][ MinUP ] == && PlayerInfo][ SegUP ] == 
                { 
                    
PlayerInfo][ SegUP ] = 00
                    
PlayerInfo][ MinUP ] = 10
                    
GanharExp(i); 
                } 
                
                if( 
PlayerInfo][ Tem_RelogioUP ] == 
                { 
                    
formatgStrsizeofgStr ), "~w~+UP~b~: ~w~%02d~b~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                    
TextDrawSetStringTextLevelUP], gStr ); 
                            
                    Switch( 
PlayerInfo] [ RelogioCor ])
                    {
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+UP~b~: ~w~%02d~b~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~y~UP: ~w~%02d~y~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~r~UP: ~w~%02d~r~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~g~UP: ~w~%02d~g~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~p~UP: ~w~%02d~p~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~b~UP: ~w~%02d~b~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~y~~h~UP: ~w~%02d~y~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 

                        { 
                            
formatgStrsizeofgStr ), "~w~+~r~~h~UP: ~w~%02d~r~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~g~~h~UP: ~w~%02d~g~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
:
                        { 
                            
formatgStrsizeofgStr ), "~w~+~p~~h~UP: ~w~%02d~p~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        } 
                        case 
10 :
                        { 
                            
formatgStrsizeofgStr ), "~w~+~b~~h~UP: ~w~%02d~b~~h~:~w~%02d"PlayerInfo][ MinUP ], PlayerInfo][ SegUP ] ); 
                            
TextDrawSetStringTextLevelUP], gStr ); 
                        }
                    }
                } 
            } 
        }
    }

Caso queira realmente aprender : https://sampwiki.blast.hk/wiki/Control_Structures
Outro link : https://sampforum.blast.hk/showthread.php?tid=240470
Como pode ver,tutorial й o que nгo falta o que falta й interesse .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)