[AJUDA] Colocar Sistema de Vip Automatico
#1

Oii, Uso o BMG e o Comando vip й Apenas /darvip [ID] [VIP1/VIP2] e eu Queria Colocar /darvip [ID] [VIP1/VIP2] [DIAS]..
Tem Como Alguem Me Ajudar?
Meu Comando /DarVip й:
pawn Код:
if(strcmp(cmd, "/darvip", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 1337)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo tem autorizaзгo para usar esse comando.");
                return 1;
            }
            VipVaga();
            if(VagaSobrando == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Nгo hб mais vagas na lista use /limparvip primeiro.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [id] [Nivel]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [id] [Nivel]");
                return 1;
            }
            level = strval(tmp);
            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(IsPlayerConnected(para1))
            {
                if(para1 != INVALID_PLAYER_ID)
                {
                    format(string, sizeof string, "Vocк deu VIP Nнvel %d para %s", level, giveplayer);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof string, "Vocк ganhou VIP Nнvel %d do admin %s", level, sendername);
                    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                    getdate(year, month, day);
                    gettime(hour,minute,second);
                    format(string, sizeof(string), "%s deu vip ao %s nнvel %d (%d/%d/%d - %d:%d)",sendername,giveplayer,level,day, month, year,hour, minute);
                    VipsLog(string);
                    PlayerInfo[para1][pVIP] = level;
                    new var03 = 0;
                    for(new i = 0; i < sizeof(VipInfo); i++)
                    {
                        if(strcmp(giveplayer,VipInfo[i][vNick],true)==0)
                        {
                            VipInfo[i][vTipo] = level;
                            SaveVip();
                            var03 = 1;
                            break;
                        }
                    }
                    if(var03 == 0)
                    {
                        for(new i = 0; i < sizeof(VipInfo); i++)
                        {
                            if(strcmp("Ninguem",VipInfo[i][vNick],true)==0)
                            {
                                strmid(VipInfo[i][vNick], giveplayer, 0, strlen(giveplayer), 255);
                                VipInfo[i][vTipo] = level;
                                SaveVip();
                                break;
                            }
                        }
                    }
                }
            }
        }
        return 1;
    }
Meu VipVaga й:
pawn Код:
public VipVaga()
{
    for(new idx=0; idx<sizeof(VipInfo); idx++)
    {
        if(strcmp(VipInfo[idx][vNick],"Ninguem", true ) == 0 )
        {
            VagaSobrando = 1;
            return 1;
        }
    }
    VagaSobrando = 0;
    return 0;
}

////////////////////////////// OU й ESSE o VIPVAGA:

enum vinfo
{
    vNick[MAX_PLAYER_NAME],
    vTipo
};
new VipInfo[51][vinfo];
forward VipCheck(playerid);
forward VipVaga();
public VipCheck(playerid)
{
    new idx = 0;
    while(idx < sizeof(VipInfo))
    {
        if(strcmp(VipInfo[idx][vNick],PlayerName(playerid), true ) == 0 )
        {
            return 1;
        }
        idx++;
    }
    return 0;
}
Meu SaveVip й:
pawn Код:
forward LoadVip();
forward SaveVip();
public SaveVip()
{
    new idx;
    new File: file2;
    while (idx < sizeof(VipInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s,%d\n",VipInfo[idx][vNick],VipInfo[idx][vTipo]);
        if(idx == 0)
        {
            file2 = fopen("Configs/Vips.cfg", io_write);
        }
        else
        {
            file2 = fopen("Configs/Vips.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
Se Nгo Forem os Comandos Certos, Desculpa, Sу Falar que eu Coloco Eles Denovo '-'
Bgd
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=271690
https://sampforum.blast.hk/showthread.php?tid=304323
Reply
#3

Procure por new PlayerInfo no seu GM e duas linhas antes do };, coloque isto:

Код:
pDays,
Lembre-se, tambйm, de fazer o saving e loading da variavel.

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
PlayerInfo[playerid][pVIP] != && gettime() >= PlayerInfo[playerid][pDays])
    {
        
SendClientMessage(playerid, -1"Seu perнodo de VIP acabou.");
        
PlayerInfo[giveid][pVIP] = 0;
        
PlayerInfo[playerid][pDays] = 0;
        new 
sStr[24];
        
GetPlayerName(playeridsStr24);
        for(new 
0sizeof(VipInfo); i++)
        {
            if(
strcmp(sStr,VipInfo[i][vNick],true)==0)
            {
                
VipInfo[i][vTipo] = 0;
                
strmid(VipInfo[i][vNick], "Ninguem"016255);
                return 
SaveVip();
            }
        }
    }
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmd"/darvip"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] < 1337)
            return 
SendClientMessage(playeridCOLOR_GRAD1"Vocк nгo tem autorizaзгo para usar esse comando.");
        
VipVaga();
        if(!
VagaSobrando)
            return 
SendClientMessage(playeridCOLOR_GRAD1"Nгo hб mais vagas na lista use /limparvip primeiro.");
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
            return 
SendClientMessage(playeridCOLOR_GRAD2"USE: /darvip [id] [nivel] [dias]");
        new 
giveid ReturnUser(tmp);
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
            return 
SendClientMessage(playeridCOLOR_GRAD2"USE: /darvip [id] [nivel] [dias]");
        new 
level strval(tmp);
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
            return 
SendClientMessage(playeridCOLOR_GRAD2"USE: /darvip [id] [nivel] [dias]");
        new 
dias strval(tmp);
        
GetPlayerName(giveidgiveplayersizeof(giveplayer));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        if(!
IsPlayerConnected(giveid) || giveid != INVALID_PLAYER_ID)
            return 
1;
        
format(stringsizeof string"Vocк deu VIP Nнvel %d para %s por %d dias"levelgiveplayerdias);
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
        
format(stringsizeof string"Vocк ganhou VIP Nнvel %d por %d dias do admin %s"leveldiassendername);
        
SendClientMessage(giveidCOLOR_LIGHTBLUEstring);
        
getdate(yearmonthday);
        
gettime(hour,minute,second);
        
format(stringsizeof(string), "%s deu vip ao %s nнvel %d por %d dias (%d/%d/%d - %d:%d)",sendername,giveplayer,leveldiasdaymonthyear,hourminute);
        
VipsLog(string);
        
PlayerInfo[giveid][pVIP] = level;
        
PlayerInfo[giveid][pDays] = gettime()+dias*86400;
        for(new 
0sizeof(VipInfo); i++)
        {
            if(
strcmp(giveplayer,VipInfo[i][vNick],true)==0)
            {
                
VipInfo[i][vTipo] = level;
                return 
SaveVip();
            }
            if(
strcmp("Ninguem",VipInfo[i][vNick],true)==0)
            {
                
VipInfo[i][vTipo] = level;
                return 
SaveVip();
            }
        }
        return 
1;
    }
    return 
0;

Reply
#4

Como eu Faзo o saving e loading da variavel ?
:/
Desculpa, So Muito Novata Com o Pawn Ainda :/
Reply
#5

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
Procure por new PlayerInfo no seu GM e duas linhas antes do };, coloque isto:

Код:
pDays,
Lembre-se, tambйm, de fazer o saving e loading da variavel.

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
PlayerInfo[playerid][pVIP] != && gettime() >= PlayerInfo[playerid][pDays])
    {
        
SendClientMessage(playerid, -1"Seu perнodo de VIP acabou.");
        
PlayerInfo[giveid][pVIP] = 0;
        
PlayerInfo[playerid][pDays] = 0;
        new 
sStr[24];
        
GetPlayerName(playeridsStr24);
        for(new 
0sizeof(VipInfo); i++)
        {
            if(
strcmp(sStr,VipInfo[i][vNick],true)==0)
            {
                
VipInfo[i][vTipo] = 0;
                
strmid(VipInfo[i][vNick], "Ninguem"016255);
                return 
SaveVip();
            }
        }
    }
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmd"/darvip"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] < 1337)
            return 
SendClientMessage(playeridCOLOR_GRAD1"Vocк nгo tem autorizaзгo para usar esse comando.");
        
VipVaga();
        if(!
VagaSobrando)
            return 
SendClientMessage(playeridCOLOR_GRAD1"Nгo hб mais vagas na lista use /limparvip primeiro.");
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
            return 
SendClientMessage(playeridCOLOR_GRAD2"USE: /darvip [id] [nivel] [dias]");
        new 
giveid ReturnUser(tmp);
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
            return 
SendClientMessage(playeridCOLOR_GRAD2"USE: /darvip [id] [nivel] [dias]");
        new 
level strval(tmp);
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
            return 
SendClientMessage(playeridCOLOR_GRAD2"USE: /darvip [id] [nivel] [dias]");
        new 
dias strval(tmp);
        
GetPlayerName(giveidgiveplayersizeof(giveplayer));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        if(!
IsPlayerConnected(giveid) || giveid != INVALID_PLAYER_ID)
            return 
1;
        
format(stringsizeof string"Vocк deu VIP Nнvel %d para %s por %d dias"levelgiveplayerdias);
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
        
format(stringsizeof string"Vocк ganhou VIP Nнvel %d por %d dias do admin %s"leveldiassendername);
        
SendClientMessage(giveidCOLOR_LIGHTBLUEstring);
        
getdate(yearmonthday);
        
gettime(hour,minute,second);
        
format(stringsizeof(string), "%s deu vip ao %s nнvel %d por %d dias (%d/%d/%d - %d:%d)",sendername,giveplayer,leveldiasdaymonthyear,hourminute);
        
VipsLog(string);
        
PlayerInfo[giveid][pVIP] = level;
        
PlayerInfo[giveid][pDays] = gettime()+dias*86400;
        for(new 
0sizeof(VipInfo); i++)
        {
            if(
strcmp(giveplayer,VipInfo[i][vNick],true)==0)
            {
                
VipInfo[i][vTipo] = level;
                return 
SaveVip();
            }
            if(
strcmp("Ninguem",VipInfo[i][vNick],true)==0)
            {
                
VipInfo[i][vTipo] = level;
                return 
SaveVip();
            }
        }
        return 
1;
    }
    return 
0;

Isso tem uma chance de lagar o sv... No meu sv o VIP automatico por via das duvidas eu pus no OnPlayerSpawn...

E bianca, use sistema de salvamento como Dini, yini... existem varios
Reply
#6

Sistema de salvamento DINI nгo fica lerdo? usa DOF
Reply
#7

So estava dando exemplos.. Sim DOF eh mais rapido
Reply
#8

Uma dъvida minha. Jб que os meses de VIP/SUPER-VIP sгo feitos com UnixTimeStamp, como fazer para mostrar somente DIAS quando estiver logado e spawnado?
Reply
#9

Converte eles para dias.
Reply
#10

Obg Aii a Todos, Principalmente ao Shadow *-*
Bjss
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)