[Ajuda] [Erro-Ajuda] Payday Textdraw
#10

Quote:
Originally Posted by Paulthaz
Посмотреть сообщение
Por que a textdraw ta sendo criada na callback do OnPlayerConnect? cada vez que o jogador conectava no servidor setava um timer em todo mundo e criava a textdraw pra todo mundo ? seria melhor assim(AO MEU VER)

PHP код:
#define Conta         "Contas/%s.ini"
new MinutosP[MAX_PLAYERS],
    
SegundosP[MAX_PLAYERS],
    
PlayerText:Textdraw0[MAX_PLAYERS];
public 
OnPlayerConnect(playerid

    new 
file[40], NomePl[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNomePlsizeof NomePl);
    
format(filesizeof fileContaNomePl);
    if(
DOF2_FileExists(file))
    {
        
MinutosP[playerid] = DOF2_GetInt(file"Minutos");
        
SegundosP[playerid] = DOF2_GetInt(file"Segundos");
    }
    
Textdraw0[playerid] = CreatePlayerTextDraw(playerid499.000000123.000000""); 
    
PlayerTextDrawBackgroundColor(playeridTextdraw0[playerid], 255); 
    
PlayerTextDrawFont(playeridTextdraw0[playerid], 1); 
    
PlayerTextDrawLetterSize(playeridTextdraw0[playerid], 0.4500000.899999); 
    
PlayerTextDrawColor(playeridTextdraw0[playerid], -16776961); 
    
PlayerTextDrawSetOutline(playeridTextdraw0[playerid], 0); 
    
PlayerTextDrawSetProportional(playeridTextdraw0[playerid], 0); 
    
PlayerTextDrawSetShadow(playeridTextdraw0[playerid], 1); 
    
PlayerTextDrawSetSelectable(playeridTextdraw0[playerid], 0); 
    return 
1

/*
*  @OBS                    - Vocк precisa adicionar o codigo abaixo na funзгo onde o player faz o login
*/
forward OnPlayerLogin(playerid);
public 
OnPlayerLogin(playerid)
{
    
PlayerTextDrawShow(playeridtextdraw0[playerid]);
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
file[40], NomePl[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNomePlsizeof NomePl);
    
format(filesizeof fileContaNomePl);
    if(
DOF2_FileExists(file))
    {
        
DOF2_SetInt(Conta"Minutos"MinutosP[playerid]);
        
DOF2_SetInt(Conta"Segundos"SegundosP[playerid]);
    }
    return 
1;
}
public 
OnGameModeInit()
{
    
SetTimer("RelogioUP"1000true);
}
forward RelogioUP();
public 
RelogioUP()
{
    foreach(new 
playeridPlayer)
    {
        if(
MinutosP[playerid] <= && SegundosP[playerid] <= 0)
        {
            
MinutosP[playerid] = 60;
            
SegundosP[playerid] = 0;
            
Payday(playerid); // << Taca o Payday
        
}
        else
        {
            if(
SegundosP[playerid] <= 0)
            {
                
MinutosP[playerid]--;
                
SegundosP[playerid] = 60;
            }
            else
                
SegundosP[playerid]--;
        }
        new 
text[30];
        
format(textsizeof text"Payday:~w~%02d:%02d"MinutosP[playerid], SegundosP[playerid]);
        
PlayerTextDrawSetString(playeridtextdraw0[playerid], text);
        
//Se colocar pra aparecer a textdraw aqui vai aparecer na tela de login tambйm, mas se quiser:
        
PlayerTextDrawShow(playeridtextdraw0[playerid]);
    }
    return 
true;

@edit.
Entгo mano esse settimer й o tempo dos segundos entendeu ? Se nгo tentarei explicar o mбximo possнvel nгo sou bom explicando, 1000(1 segundo) significa que o tempo contarб de 1 em 1 segundos, se vocк colocar para 2 contara os segundos de 2 em 2 entendeu ?
Reply


Messages In This Thread
[Erro-Ajuda] Payday Textdraw - by Abne - 15.12.2017, 03:15
Re: [Erro-Ajuda] Payday Textdraw - by MediaCL - 15.12.2017, 03:30
Re: [Erro-Ajuda] Payday Textdraw - by DelK - 15.12.2017, 07:12
Re: [Erro-Ajuda] Payday Textdraw - by Marllun - 15.12.2017, 07:20
Re: [Erro-Ajuda] Payday Textdraw - by MediaCL - 16.12.2017, 00:53
Re: [Erro-Ajuda] Payday Textdraw - by Mises - 16.12.2017, 01:56
Re: [Erro-Ajuda] Payday Textdraw - by Abne - 16.12.2017, 17:32
Re: [Erro-Ajuda] Payday Textdraw - by MediaCL - 16.12.2017, 17:46
Re: [Erro-Ajuda] Payday Textdraw - by Paulthaz - 16.12.2017, 19:04
Re: [Erro-Ajuda] Payday Textdraw - by DelK - 16.12.2017, 19:37

Forum Jump:


Users browsing this thread: 1 Guest(s)