[Ajuda] /TempVip e aviso
#1

Boa Tarde,

Estou com duas dъvidas ...

1Є - Como faзo para que o player saiba quantos dias restam do vip dele?

Код:
CMD:setvip(playerid, params[])
{
    new id, pDias, Outro[MAX_PLAYER_NAME], Jogador[MAX_PLAYER_NAME], string[128], string1[128];
	if(Logado[playerid] == false) return SendClientMessage(playerid,-1,"{008B00}[ ATENЗГO ] {FFFFFF}Й preciso logar para executar este comando");
	if(!(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] == 6))return SendClientMessage(playerid, -1, "{008B00}[ ATENЗГO ] {FFFFFF}Comando Restrito, apуs 3 tentativas tomarб BAN");
	if(sscanf(params, "uii", id, Nivel, pDias)) return SendClientMessage(playerid, -1, "{FFA500}[ USE ] /setvip [ID] [Nнvel de VIP] [Dias]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}[ERRO] {FFFFFF}Jogador nгo conectado");
    if(Nivel > 3) return SendClientMessage(playerid, -1, "{008B00}[ ATENЗГO ] {FFFFFF}O Mбximo De Level a se dar й 3");
    if(pDias < 1) return SendClientMessage(playerid, -1, "{FF0000}[ERRO] {FFFFFF}Dias maiores que 0!");
    
	PlayerInfo[id][pVip] = Nivel;
	PlayerInfo[id][pTimeV] = gettime() + (pDias * 24 * 60 * 60);

	GetPlayerName(id, Outro, MAX_PLAYER_NAME);
 	format(string, sizeof(string), "{FFA500}[ ADMINISTRAЗГO ] {FFFFFF}O Player %s agora й VIP %s {FFFFFF}por %d dia(s)", Outro, GetPlayerVIP(id), pDias);
   	SendClientMessageToAll(-1, string);

	format(string, 128, "{FFFFFF}Parabйns, agora vocк faz parte da elite do servidor\n");
	strcat(string1,string);
	format(string, 128, "{FFFFFF}VIP: %s\n", GetPlayerVIP(id));
	strcat(string1,string);
	format(string, 128, "{FFFFFF}TEMPO: %d dias\n", pDias);
	strcat(string1,string);
	ShowPlayerDialog(id, 7564, DIALOG_STYLE_MSGBOX, "{FF0000}» {FFFFFF}COMPROU VIP {FF0000}«", string1, "Fechar", "");
	
	GetPlayerName(playerid, Jogador, MAX_PLAYER_NAME);
	printf("[VIP]- %s setou %s de vip level %s por %d dia(s).", Jogador, Outro, GetPlayerVIP(id), pDias);
	return 1;
}
2Є - De que forma posso informar ao player que o vip estб esgotando um dia antes do mesmo esgotar?
Reply
#2

faz uma verificaзгo uй.
TIPO ESSA...

Код:
               new tick = Now();
            	if(tick > PlayerInfo[playerid][pDiasVIP])
		{
	             SendClientMessage(playerid, -1, "SERVER: Seu VIP expirou.");
	             PlayerInfo[playerid][VIP] = 0;
	             PlayerInfo[playerid][pDiasVIP]= 0;
                     DOF2_SetInt(String,"viptemp", 0);
	             SalvarDados(playerid);
                }
                else
		{
                new String[128];
    	       format(String, sizeof(String), "SERVER: Seu VIP expira em %s: ",SistemaVipSpeed(PlayerInfo[playerid][pDiasVIP]-Now()));
		SendClientMessage(playerid, -1,String);
                }
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=404067
Reply
#4

pawn Код:
command(dias , playerid , params [] )
{
    new str [ 50 ];
    format ( str ,sizeof ( str ) , "Dias : %d", PlayerInfo [ playerid ] [ pTimeV ] ) ;
    SendClientMessage ( playerid , -1 , str ) ;
    return 1 ;
}
// onplayerconect
    if ( PlayerInfo [ playerid ] [ pTimeV ]  < 1 )
    {
        SendClientMessage ( playerid , -1 , "Seu Vip acaba amanha " ) ;
        return 1 ;
     }
Reply
#5

Quote:
Originally Posted by mau.tito
Посмотреть сообщение
pawn Код:
command(dias , playerid , params [] )
{
    new str [ 50 ];
    format ( str ,sizeof ( str ) , "Dias : %d", PlayerInfo [ playerid ] [ pTimeV ] ) ;
    SendClientMessage ( playerid , -1 , str ) ;
    return 1 ;
}
// onplayerconect
    if ( PlayerInfo [ playerid ] [ pTimeV ]  < 1 )
    {
        SendClientMessage ( playerid , -1 , "Seu Vip acaba amanha " ) ;
        return 1 ;
     }
Vocк deve ter percebido que pTimeV й o tempo vip em segundos nгo ?

Olhe o cуdigo do paulor!
Reply
#6

Quote:
Originally Posted by Programador_Macabro
Посмотреть сообщение
Vocк deve ter percebido que pTimeV й o tempo vip em segundos nгo ?

Olhe o cуdigo do paulor!
Eu sei e so ele trocar mano !
Reply
#7

Quote:
Originally Posted by Programador_Macabro
Посмотреть сообщение
Vocк deve ter percebido que pTimeV й o tempo vip em segundos nгo ?

Olhe o cуdigo do paulor!
Deu certo aqui, mais me diz uma coisa.

Como ficaria aquela conta lб, com menos 1 dia?

Para pode informar o player 1 dia antes dele acabar?
Reply
#8

pawn Код:
if ( (((PlayerInfo[id][pTimeV] - gettime()) / 60) / 60) / 24 < 1 ) {

    SendClientMessage(playerid, -1, "Seu VIP expira em menos de 24 horas!");

}
Tem outras formas para pegar o tempo com maior precisгo (Horas/Minutos/Segundos).
Reply
#9

Quote:
Originally Posted by Programador_Macabro
Посмотреть сообщение
pawn Код:
if ( (((PlayerInfo[id][pTimeV] - gettime()) / 60) / 60) / 24 < 1 ) {

    SendClientMessage(playerid, -1, "Seu VIP expira em menos de 24 horas!");

}
Tem outras formas para pegar o tempo com maior precisгo (Horas/Minutos/Segundos).
Obrigado!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)