Portal SAMP
[Ajuda] Data no rodape - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Data no rodape (/showthread.php?tid=3944)



Data no rodape - brnvasc - 04/09/2023

Salve salve 

ultilizo um sistema de rodape que define oque vai pararecer na textdraw por uma string, estou tentando adicionar parar mostrar nessa string a data, mas apos a modificação o rodape some 

(Obs o GM compila sem erros) 

Código PHP:
public RodapeTxt2()//
{
    foreach(Playeri)
    {
    new ano,mes,dia,;
    getdate(anomesdia);
    new string[256];
    
format(stringsizeof(string), "~w~ discord.gg/zZZVxnc ~g~   %s   ~g~ ~w~ID: %d     Level: %d Servidor BvR ~w~ ~r~ %d %d %d ~r~ ",PlayerName(i), iPlayerInfo[i][pLevel],(i), anomesdia);
    
TextDrawSetString(Rodape[i], string);
    
TextDrawShowForPlayer(iRodape[i]);
}




RE: Data no rodape - Aranha - 04/09/2023

se eu estiver errado alguem corrija pf

no lugar de foreach use playerid

forward RodapeTxt2(playerid);
public RodapeTxt2(playerid) {

em vez de TextDrawCreate use CreatePlayerTextDraw

PlayerTextDrawSetString(playerid


RE: Data no rodape - White_Blue - 04/09/2023

(04/09/2023 21:57)Aranha Escreveu: se eu estiver errado alguem  corrija pf

no lugar de foreach use playerid

forward RodapeTxt2(playerid);
public RodapeTxt2(playerid) {

em vez de TextDrawCreate use CreatePlayerTextDraw

PlayerTextDrawSetString(playerid

Está correto, mas vale lembrar que essa sintaxe do foreach é antiga, mas de qualquer modo, está correta.

E também, a Textdraw é global, então a manipulação da mesma está correta.


Nesse código, não pude notar nada de incorreto, exceto o fato de que você está declarando variáveis dentro de um loop, o que eu não recomendo.

Código corrigido:

Código PHP:
public RodapeTxt2() {
    new anomesdia// Nota: Após a variável dia, tinha uma vírgula sobrando.
    getdate(anomesdia);
    new string[256];
    foreach(Playeri) {
     format(stringsizeof(string), "~w~ discord.gg/zZZVxnc ~g~   %s   ~g~ ~w~ID: %d     Level: %d Servidor BvR ~w~ ~r~ %d %d %d ~r~ ",PlayerName(i), iPlayerInfo[i][pLevel],(i), anomesdia);     TextDrawSetString(Rodape[i], string);
     TextDrawShowForPlayer(iRodape[i]);
    }
    return 1;



Se possível mostrar o código de criação da Textdraw e também como você está usando a callback "RodapeTxt2".


RE: Data no rodape - xbruno1000x - 04/09/2023

(04/09/2023 21:57)Aranha Escreveu: se eu estiver errado alguem  corrija pf

no lugar de foreach use playerid

forward RodapeTxt2(playerid);
public RodapeTxt2(playerid) {

em vez de TextDrawCreate use CreatePlayerTextDraw

PlayerTextDrawSetString(playerid

Eu concordo com você, melhor criar uma PlayerTextdraw e colocar um SetTimeEx.


RE: Data no rodape - brnvasc - 06/09/2023

grl obrigado pela a ajuda, consegui resolver o prblema remomendo o gettime do cogido e ja usando as variaveis que uso pra salvar data e hora de acontecimentos dentro o servidor ( para registro interno)