SA-MP Forums Archive
Problem with registration date - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with registration date (/showthread.php?tid=627594)



Problem with registration date - BrianFaria - 29.01.2017

Hello, I have a problem, create a user registration system, that is, detect the date, but in / stats does not come out. Only the first number of the record comes out, what can it be?

Login:

Код:
db_get_field_assoc(Result, "REGISTRO", Field, 45);
PlayerInfo[playerid][Registro]=strval(Field);
/Stats

Код:
format(stats,sizeof(stats),"{00FF00}» Registro: {FFFFFF}%d/%d/%d\n",PlayerInfo[playerid][Registro]);
strcat(xdxdxd,stats);
Image:



Re: Problem with registration date - BrianFaria - 29.01.2017

help


Re: Problem with registration date - saffierr - 29.01.2017

You are using three '%d' specifiers, yet you define one of them.


Re: Problem with registration date - BrianFaria - 29.01.2017

Help!


Re: Problem with registration date - saffierr - 29.01.2017

You're defining just one '%d' specifier with 'PlayerInfo[playerid][Registro]'.
So the two other '%d' specifiers, will return '0'.
PHP код:
format(stats,sizeof(stats),"{00FF00}» Registro: {FFFFFF}%d/%d/%d\n",PlayerInfo[playerid][Registro]); 
Do you understand that?


Re: Problem with registration date - BrianFaria - 30.01.2017

Yes, but then how would it be? If I put one, it does not walk the same.


Respuesta: Problem with registration date - Eloy - 30.01.2017

try using especifier %s to strings

PHP код:
format(stats,sizeof(stats),"{00FF00}» Registro: {FFFFFF}%s",PlayerInfo[playerid][Registro]); 



Re: Problem with registration date - BrianFaria - 30.01.2017

It does not work.



Respuesta: Problem with registration date - Eloy - 30.01.2017

Set your column REGISTRO type Varchar, and use this function to get Date and Hour



PHP код:
Before Main()
new 
Meses[12][11] =    { {"Enero"}, {"Febrero"}, {"Marzo"}, {"Abril"}, {"Mayo"}, {"Junio"}, {"Julio"}, {"Agosto"}, {"Septiembre"}, {"Octubre"}, {"Noviembre"}, {"Diciembre"} };
ReturnDate()
{
    static 
date[36] ;
    
getdate(date[2], date[1], date[0]);
    
gettime(date[3], date[4], date[5]);
    
date[1]--;
        
    if(
date[3] < 12){
        
format(datesizeof(date), "%02d %s %d, %02d:%02d AM "date[0], Meses[date[1]], date[2], date[3], date[4]);
    }
    else if(
date[3] > 12){
        
date[3] = date[3]-12;
        
format(datesizeof(date), "%02d %s %d, %02d:%02d PM"date[0], Meses[date[1]], date[2], date[3], date[4]);
    }
    else if(
date[3] == 12){
        
format(datesizeof(date), "%02d %s %d, %02d:%02d PM"date[0], Meses[date[1]], date[2], date[3], date[4]);
    }
    return 
date;




Re: Problem with registration date - BrianFaria - 30.01.2017

I want to find solution to the script that I put, because in the database it detects it well, the problem is in the command /stats