[Ajuda] /darvip com dias
#1

Boa noite/dia/tarde a todos

Bem eu comecei a estudar a linguagem pawn e achei muito interessante e estou atualmente estudando a include dini to fazendo um FS q tem um sisteminha bбsico de vip com salvamento em dini e queria o /darvip, tipo com dias eu dou tipo 1 dia pra tal player e quando acabar esse dia o vip й retirado automaticamente jб tentei colocar timer's mais sempre da erro :X. bem aqui esta um previa do comando sem o timer:


pawn Код:
if(strcmp(cmd, "/darvip", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_FSVIP, aname);
{
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "Digite: /darvip [id]");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_FSVIP, pname);
dini_IntSet(file2, "VIP",1);
SpawnPlayer(plid);
SendClientMessage(playerid, 0x00FF00AA, "O VIP dado com sucesso");
SendClientMessage(plid, 0x00FF00AA, "Um adminstrador setou VIP para vocк aproveite ;D");
return 1;
}else{
SendClientMessage(playerid, Vermelho, "ID invбlido");
return 1;
}
}
}
Cumpz,
Reply
#2

http://en.wikipedia.org/wiki/Unix_time

gettime
Reply
#3

Oi arakuta,
tava trabalhando nesse codigo e encontrei um tutorial de gettime atй fiz o codigo so que deu 1 warning '-'

PHP код:
C:\....\.....\FSVip.pwn(721) : warning 202number of arguments does not match definition
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Warning

mais aqui esta o codigo completo
PHP код:
if(strcmp(cmd"/darvip"true) == 0) {
new 
aname[MAX_PLAYER_NAME];
GetPlayerName(playeridanameMAX_PLAYER_NAME);
format(filesizeof(file), PASTA_FSVipaname);
{
new 
tmp[256];
new 
plid;
new 
dvip;
new 
dias;
tmp strtok(cmdtextidx);
if(!
strlen(tmp)) {
SendClientMessage(playeridVermelho"Digite: /darvip [id] [dias]");
return 
1;
}
plid strval(tmp);
if(
IsPlayerConnected(plid)){
new 
pname[MAX_PLAYER_NAME];
GetPlayerName(plidpnamedvipMAX_PLAYER_NAME); //Linha do Warning
format(file2sizeof(file2), PASTA_FSVippname);
dini_IntSet(file2"VIP",1);
DoVip[plid][pDias] = (gettime() + (dias 24 60 60));
SpawnPlayer(plid);
SendClientMessage(playerid0x00FF00AA"O VIP dado com sucesso");
SendClientMessage(plid0x00FF00AA"Um admin setou VIP para vocк aproveite ;D");
return 
1;
}else{
SendClientMessage(playeridVermelho"ID invбlido");
return 
1;
}
}

Ajuda-me?
Reply
#4

Amigo, uma base, basta adaptar.
pawn Код:
if( !strcmp( cmd, "/darvip", true ))
    {
        tmp = strtok( cmdtext, idx );
        if( !strlen( tmp ))
        {
            SendClientMessage( playerid, Vermelho, "Uso certo: /SetarVIP [ID] [Dia] [Mкs] [Ano]" );
            return 1;
        }
        new
            id = strval( tmp )
        ;
        if( !IsPlayerConnected( id ))
        {
            SendClientMessage( playerid, 0x00FF00AA, "Nгo hб ninguйm ONLINE com este ID " );
            return 1;
        }
        tmp = strtok( cmdtext, idx );
        if( !strlen( tmp ))
        {
            SendClientMessage( playerid, Vermelho, "Uso certo: /SetarVIP [ID] [Dia] [Mкs] [Ano]" );
            return 1;
        }
        new
            MesFinal = strval( tmp )
        ;
        tmp = strtok( cmdtext, idx );
        if( !strlen( tmp ))
        {
                        SendClientMessage( playerid, Vermelho, "Uso certo: /SetarVIP [ID] [Dia] [Mкs] [Ano]" );
            return 1;
        }
        new
            DiaFinal = strval( tmp )
        ;
        tmp = strtok( cmdtext, idx );
        if( !strlen( tmp ))
        {
            SendClientMessage( playerid, Vermelho, "Uso certo: /SetarVIP [ID] [Dia] [Mкs] [Ano]" );
            return 1;
        }
        new
            AnoFinal = strval( tmp )
        ;
        if( AnoFinal > ANO_LIMITE+1 )
        {
            SendClientMessage( playerid, Vermelho, "[ x ] Apenas pode setar 1 ano acima do atual !" );
            return 1;
        }
        SendClientMessage( playerid, 0x00FF00AA, gStr );
        dini_IntSet( f( id ), "VIP_MES", MesFinal );
        dini_IntSet( f( id ), "VIP_DIA", DiaFinal );
        dini_IntSet( f( id ), "VIP_ANO", AnoFinal );
        dini_IntSet(file2, "VIP",1);
        return 1;
    }
Para Salvar o VIP.


pawn Код:
stock getarVIP( playerid )
{
    if( dini_Int( file2, "VIP", 1 )
    {
        new
            Ano[ 2 ], Mes[ 2 ], Dia[ 2 ]
        ;
        getdate( Ano[ 0 ], Mes[ 0 ], Dia[ 0 ] );

        Mes[ 1 ] = dini_Int( f( playerid ), "VIP_MES" ); // Dar VIP
        Dia[ 1 ] = dini_Int( f( playerid ), "VIP_DIA" );
        Ano[ 1 ] = dini_Int( f( playerid ), "VIP_ANO" );

        if( dini_Int( f( playerid ), "VIP_ANO" ) == 0 )
        {
            dini_IntSet( f( playerid ), "VIP_ANO", Ano[ 0 ] );
        }
        if( Mes[ 0 ] != MES_LIMITE || Ano[ 0 ] != ANO_LIMITE )

            if( Mes[ 1 ] == 2 && Mes[ 0 ] == 2 && Dia[ 1 ] >= 28 && Dia[ 0 ] >= 28 && Ano[ 1 ] <= Ano[ 0 ] || Mes[ 0 ] == Mes[ 1 ] && Dia[ 0 ] >= Dia[ 1 ] && Ano[ 1 ] <= Ano[ 0 ] || Mes[ 0 ] > Mes[ 1 ] && Ano[ 1 ] <= Ano[ 0 ] )
            {
                pInfo[ playerid ][ PLAYER_VIP ] = 0;
                dini_IntSet( file2, "VIP", 0 ); // Fim do VIP <<
                dini_IntSet( f( playerid ), "VIP_MES", 0 );
                dini_IntSet( f( playerid ), "VIP_DIA", 0 );
                dini_IntSet( f( playerid ), "VIP_ANO", 0 );
                }
            }
        }
    }
Reply
#5

Tá bem ja consegui resolver.
@Closed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)