SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 31/08/2019, 09:18 PM   #1
GasparzinhoXD
Huge Clucker
 
Join Date: Oct 2017
Posts: 215
Reputation: 2
Default getdate + VIP

Bom, eu estou fazendo assim:

pawn Code:
// Quando recebe o VIP

PlayerInfo[playerid][pDiasVIP] = getdate()+30;
PlayerInfo[playerid][pVIP] = 1;

// Quando ele faz Login

if(PlayerInfo[playerid][pVIP] == 1)  // Verificar se venceu
{
    if(getdate() >= PlayerInfo[playerid][pDiasVIP]) {

        PlayerInfo[playerid][pDiasVIP] = 0;
        PlayerInfo[playerid][pVIP] = 0;
    }
}

Mas as vezes acontece do VIP expirar antes mesmo de acabar os dias, tipo... acaba antes, se alguém puder me ajudar eu agradeço.
GasparzinhoXD is offline   Reply With Quote
Old 31/08/2019, 09:22 PM   #2
RodrigoMSR
High-roller
 
RodrigoMSR's Avatar
 
Join Date: Mar 2015
Location: Brazil
Posts: 1,059
Reputation: 140
Default Re: getdate + VIP

Use gettime, é mais preciso e garantido.

PHP Code:
// Quando recebe o VIP

PlayerInfo[playerid][pDiasVIP] = gettime() + 30 86400//em segundos, 86400‬seg = 1 dia
PlayerInfo[playerid][pVIP] = 1;

// Quando ele faz Login 

if(PlayerInfo[playerid][pVIP] == 1)  // Verificar se venceu 
{
    if(
gettime() >= PlayerInfo[playerid][pDiasVIP]) {

        
PlayerInfo[playerid][pDiasVIP] = 0;
        
PlayerInfo[playerid][pVIP] = 0;
    }

__________________
sttserver.net

RodrigoMSR is offline   Reply With Quote
Old 31/08/2019, 09:24 PM   #3
GasparzinhoXD
Huge Clucker
 
Join Date: Oct 2017
Posts: 215
Reputation: 2
Default Re: getdate + VIP

Blz, vlw mano. +REP
GasparzinhoXD is offline   Reply With Quote
Old 01/09/2019, 07:42 AM   #4
GasparzinhoXD
Huge Clucker
 
Join Date: Oct 2017
Posts: 215
Reputation: 2
Default Re: getdate + VIP

Mano, eu estava tentando aqui e não consigo de jeito nenhum fazer o cálculo para mostrar tipo: Falta tantos dias para expirar seu VIP. Pode me ajudar com isso?
GasparzinhoXD is offline   Reply With Quote
Old 01/09/2019, 10:24 AM   #5
NWDMadara
Gangsta
 
NWDMadara's Avatar
 
Join Date: Mar 2018
Posts: 507
Reputation: 16
Default Re: getdate + VIP

PHP Code:
function rHoraMinuto(InputSecOutputString[], OutputStringLen)
{
    new 
DaysHoursMinsSecs;

    
Days floatround((InputSec 86400), floatround_floor); // get Days
    
Secs = (InputSec - (Days 86400));// remove days from total seconds
    
Hours floatround((Secs 3600), floatround_floor); // get Hours
    
Secs = (Secs - (Hours 3600)); // remove Hours from secs
    
Mins floatround((Secs 60), floatround_floor);// get Mins
    
Secs = (Secs - (Mins 60));// remove Mins from secs, whats left is seconds

    
if(Days 0format(OutputStringOutputStringLen"%i dia(s) %i hora(a) e %i minuto(s)."DaysHoursMins);
    else if(
Hours 0format(OutputStringOutputStringLen"%i hora(a) e %i minuto(s)."HoursMins);
    else 
format(OutputStringOutputStringLen"%i minuto(s)."Mins);
    return 
1;

NWDMadara is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getdate help DetoNater Scripting Help 10 25/12/2015 11:20 PM
[Ajuda] GetDate F1N4L Português/Portuguese 3 15/11/2015 01:50 PM
[Off] Bug getdate dia 31/12 BielCOP Português/Portuguese 1 29/05/2013 09:15 PM
[HELP] GetDate Larsey123IsMe Help Archive 2 10/12/2010 03:42 AM
getdate(...day) bug Danut Help Archive 4 30/04/2009 09:58 PM


All times are GMT. The time now is 07:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.