[Ajuda] comando /comprarvip
#1

Olá, meu comando /comprarvip está bugado, tipo, um vip é 4000 cash, mesmo ele sem ter os cash e digitar o comando ele pega todos os direitos do vip e quando ele reloga, a conta dele volta a ser Free. Mas isso só acontece quando ele realmente não tem os cash na conta.
Sou novato nisso e ainda não sei resolver erros desse tipo.

PHP код:
    if(strcmp(cmd"/comprarvip"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pVIP] >= 1)
            {
                
SendClientMessage(playeridCOLOR_WHITE"Você já possui um VIP ativo.");
                return 
1;
            }
            
VipVaga();
            if(
VagaSobrando == 0)
            {
                
SendClientMessage(playeridCOLOR_WHITE"Não possui mais vagas de VIP.");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"Use /comprarvip [1-3].");
                
SendClientMessage(playeridCOLOR_WHITE"1= VIP, 1000 cash. {FFFF00}2= VIP PREMUIM, 2500 cash. {0000FF}3= VIP SÓCIO, 4000 cash");
                return 
1;
            }
            new 
level;
            
level strval(tmp);
            {
                {
                    
getdate(yearmonthday);
                    
gettime(hour,minute,second);
                    
PlayerInfo[playerid][pVIP] = level;
                    new 
var03 0;
                    new 
Anov,Mesv,Diav,Horav,Minutov,SegV;
                    
getdate(AnovMesvDiav);
                    
gettime(HoravMinutovSegV);
                    if(
Mesv == 12 && Anov == 2012) { Mesv 1Anov++;} else { Mesv++; }
                    if(
level == 1)
                    {
                        if (
PlayerInfo[playerid][tCash] < 1000)
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"Você não possui '1000' de CASH.");
                            return 
1;
                        }
                        else
                        {
                            new 
VipNivel 1;
                            new 
VipGrana 1000000;
                            
PlayerInfo[playerid][tCash] -= 1000;
                            
PlayerPlaySound(playerid10840.00.00.0);
                            
SendClientMessage(playeridCOLOR_WHITE,"*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*{FFFF00}[Liberação do VIP]{FFFFFF}*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*");
                            
PlayerInfo[playerid][pConta] += VipGrana;
                            
PlayerInfo[playerid][pLevel] += VipNivel;
                            
format(stringsizeof string"- Você ativou seu VIP nível: {FFFF00}%d"level);
                            
SendClientMessage(playeridCOLOR_WHITEstring);
                            
format(gstringsizeof(gstring), "- Você recebeu {00FF00}%dR$ {FFFFFF}em sua conta bancária."VipGrana);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
format(gstringsizeof(gstring), "- Você recebeu mais {FFFF00}%d {FFFFFF}de nível em seu personagem."VipNivel);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
format(gstringsizeof(gstring), "* VENCIMENTO DO VIP: {FFFF00}%d/%d/%d, {FFFFFF}HORA: {FFFF00}%d:%d:%d."Diav,Mesv,Anov,Horav,Minutov,SegV);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
SendClientMessage(playeridCOLOR_LIGHTBLUE,"*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~**~~*~~*~~*~~*~~*~~*~~*~~*~~*~~**~~*~~*~~*~~*~~*~~*");
                        }
                    }
                    else if(
level == 2)
                    {
                        if (
PlayerInfo[playerid][tCash] < 2500)
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"Você não possui '2500' de CASH.");
                            return 
1;
                        }
                        else
                        {
                            new 
VipGrana 2500000;
                            new 
VipNivel 2;
                            
PlayerInfo[playerid][tCash] -= 2500;
                            
PlayerPlaySound(playerid10840.00.00.0);
                            
SendClientMessage(playeridCOLOR_WHITE,"*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*{FFFF00}[Liberação do VIP]{FFFFFF}*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*");
                            
PlayerInfo[playerid][pConta] += VipGrana;
                            
PlayerInfo[playerid][pLevel] += VipNivel;
                            
format(stringsizeof string"- Você ativou seu VIP nível: {FFFF00}%d"level);
                            
SendClientMessage(playeridCOLOR_WHITEstring);
                            
format(gstringsizeof(gstring), "- Você recebeu {00FF00}%dR$ {FFFFFF}em sua conta bancária."VipGrana);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
format(gstringsizeof(gstring), "- Você recebeu mais {FFFF00}%d {FFFFFF}de nível em seu personagem."VipNivel);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
format(gstringsizeof(gstring), "* VENCIMENTO DO VIP: {FFFF00}%d/%d/%d, {FFFFFF}HORA: {FFFF00}%d:%d:%d."Diav,Mesv,Anov,Horav,Minutov,SegV);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
SendClientMessage(playeridCOLOR_LIGHTBLUE,"*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~**~~*~~*~~*~~*~~*~~*~~*~~*~~*~~**~~*~~*~~*~~*~~*~~*");
                        }
                    }
                    else if(
level == 3)
                    {
                        if (
PlayerInfo[playerid][tCash] < 4000)
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"Você não possui '4000' de CASH.");
                            return 
1;
                        }
                        else
                        {
                            new 
VipGrana 3500000;
                            new 
VipNivel 3;
                            
PlayerInfo[playerid][tCash] -= 4000;
                            
PlayerPlaySound(playerid10840.00.00.0);
                            
SendClientMessage(playeridCOLOR_WHITE,"*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*{FFFF00}[Liberação do VIP]{FFFFFF}*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*");
                            
PlayerInfo[playerid][pConta] += VipGrana;
                            
PlayerInfo[playerid][pLevel] += VipNivel;
                            
format(stringsizeof string"- Você ativou seu VIP nível: {FFFF00}%d"level);
                            
SendClientMessage(playeridCOLOR_WHITEstring);
                            
format(gstringsizeof(gstring), "- Você recebeu {00FF00}%dR$ {FFFFFF}em sua conta bancária."VipGrana);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
format(gstringsizeof(gstring), "- Você recebeu mais {FFFF00}%d {FFFFFF}de nível em seu personagem."VipNivel);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
format(gstringsizeof(gstring), "* VENCIMENTO DO VIP: {FFFF00}%d/%d/%d, {FFFFFF}HORA: {FFFF00}%d:%d:%d."Diav,Mesv,Anov,Horav,Minutov,SegV);
                            
SendClientMessage(playeridCOLOR_WHITEgstring);
                            
SendClientMessage(playeridCOLOR_LIGHTBLUE,"*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~**~~*~~*~~*~~*~~*~~*~~*~~*~~*~~**~~*~~*~~*~~*~~*~~*");
                        }
                    }
                    
ScoreLevel(playerid);
                    for(new 
0sizeof(VipInfo); i++)
                    {
                        if(
strcmp(PlayerName(playerid),VipInfo[i][vNick],true)==0)
                        {
                            
VipInfo[i][vDia] = Diav;
                            
VipInfo[i][vMes] = Mesv;
                            
VipInfo[i][vAno] = Anov;
                            
VipInfo[i][vHora] = Horav;
                            
VipInfo[i][vMinuto] = Minutov;
                            
VipInfo[i][vSegundo] = SegV;
                            
SaveVip();
                            
var03 1;
                            break;
                        }
                    }
                    if(
var03 == 0)
                    {
                        for(new 
0sizeof(VipInfo); i++)
                        {
                            if(
strcmp("Ninguem",VipInfo[i][vNick],true)==0)
                            {
                                
strmid(VipInfo[i][vNick], PlayerName(playerid), 0strlen(PlayerName(playerid)), 255);
                                
VipInfo[i][vDia] = Diav;
                                
VipInfo[i][vMes] = Mesv;
                                
VipInfo[i][vAno] = Anov;
                                
VipInfo[i][vHora] = Horav;
                                
VipInfo[i][vMinuto] = Minutov;
                                
VipInfo[i][vSegundo] = SegV;
                                break;
                            }
                        }
                    }
                    
SalvarPlayer(playerid);
                    
SaveVip();
                }
            }
        }
        return 
1;
    } 
Reply
#2

vou copiar ele e vк aqui!
Reply
#3

Quote:
Originally Posted by Jonorusc
Посмотреть сообщение
vou copiar ele e vк aqui!
Obrigado.
Reply
#4

Mano eu nгo entendi direito oque vocк queria dizer com esse cуdigo, ai crie um baseado!

PHP код:
//usa um processador de comando e melhor e vou usar dialogs, fica mais bonitinho, mas se nao quiser a base e a mesma!
#include "ocmd" //ou
#include "ZCMD"
#define SendStringMsg(%0,%1,%2,%3) do{new _string[128]; \
format(_string,sizeof(_string),%2,%3); SendClientMessage(%0,%1,_string);} while(False)
#define SendStringMsgToAll(%0,%1,%2) do{new _string[128]; \
format(_string,sizeof(_string),%1,%2); SendClientMessageToAll(%0,_string);} while(False)
new 
False=false;
#define VIPS 1
ocmd:comprarvip(playerid,params[]) //usa o zmcd se quiser

   if(!
IsPlayerConnected(playerid)) return 0;
   if(
PlayerInfo[playerid][pVIP] >= 1) return SendClientMessage(playeridCOLOR_WHITE"Vocк jб possui um VIP ativo."); 
   
VipVaga(); 
   if(
VagaSobrando == 0) return SendClientMessage(playeridCOLOR_WHITE"Nгo possui mais vagas de VIP."); 
   
   
ShowPlayerDialog(playeridVIPSDIALOG_STYLE_LIST"Vips disponiveis""BASIC VIP\n PREMIUM VIP\n SУCIO VIP""Ok""Nгo"); 
   return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
   if(
dialogid == VIPS)
   {
    if(!
response//aqui vocde pode tira o '!' tira o "nгo" do ShowPlayer la, e fica so o response do ok, caso ele aperte esc na hora de escolher, somente ira sai do comando
    
{
        
SendClientMessage(playerid, -1"Vocк cancelou a compra do vip!");
    } 
//fechando botao cancelar
    
else //abrindo botгo ok
    
{
         
/*
         Aqui vocк coloca a variavel dos dias e anos, aqui era vira uma global para o dialog vips, nao precisa criar outras destas aqui
         */
        
if(Mesv == 12 && Anov == 2012) { Mesv 1Anov++;} else { Mesv++; } 
        if(
listitem == 0//basico
       
{
            
/*
                       if (PlayerInfo[playerid][tCash] < 1000) 
                        { 
                            SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo possui '1000' de CASH."); 
                            return 1; 
                        } 
                        creio que seja dinheiro! ent uzarei essa forma de abaixo
            */
            
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playeridCOR_ERROR"ERRO: Vocк nгo tem R$1000 $CASH!");
            
//se ele tiver os 1000 agora nos vai tirar dele, como compra do vip
            
GivePlayerMoney(playerid, -1000);
            
SetPlayerScore(playeridGetPlayerScore(playerid) + 1); //ganhou mais um score, pelo oque eu entendi ai
            //vou criar uma funзгo pra usar strings com variaveis, sem fica criando strings (em cima do gm)
            
new Nome[500]; GetPlayerName(playeridNomesizeof(Nome));
            
SendStringMsgToAll(COR_ERROR"[ VIP ANNCIO ] > O jogador %s acabou de comprar o vip pacote BASICO com 1000 cash!"Nome);
            
SendStringMsg(playerid, -1"Parabйns %s vocк agora й vip"Nome);
            
PlayerInfo[playerid][pVIP] = 1//setando que ele jб e vip no nivel basico = 1
            //aqui vocк coloca o tanto de cash vip etc os dias etc
            
SendStringMsg(playerid, -1"Vocк ganhou %s de cash vip"varial );
            
SendStringMsg(playerid, -1"Vocк ganhou +1 level e foi para o %i "GetPlayerScore(playerid));
            
SendStringMsg(playerid, -1"Vencimento: %d dias %d mкs %d ano %d As %d %d e %d Segundos!"Diav,Mesv,Anov,Horav,Minutov,SegV);
            
SendClientMessage(playerid, -1"Aproveite as funзхes vips /comandosvips"); //comando ficticio 
            
            //e o resto do sistema
            //salva
            /*
            new String[128];
            GetPlayerName(playerid, Nome, sizeof(Nome));
            format(String, sizeof(String), "LOCAL/DO/VIP/%s.ini", Nome); %s vai pega o nome do jogador vip
            */
            
new String[128];
            
GetPlayerName(playeridNomesizeof(Nome));
            
format(Stringsizeof(String), "SERVER/VIPS/%s.ini"Nome); 
           
//coloca a #include dof2 se for usa esse metodo de salvamento, se nao use o preferido
            //e usa DOF2_Exit() no Gamemode exit
            
DOF2_CreateFile(String);
            
DOF2_SetString(String"Pacote""Basico");
            
DOF2_SetInt(String"Setado"); //1 do pacote 1
            //tu coloca pra salvar os dias tbm, mas acho qeu vc ja tem seu salvamento ai, ent tu sabe oque fazer
           //para salva voce pode usar o DOF2_SaveFile mas um jeito mais eu fasso de um jeito mais pratico com stocks
            //com esses dados vocк cria uma checagem pra olha quem passo dos dias de vencimento, caso sim perde o vip etc
 
       
}
       if(
listitem == 1)//premium
       
{
       }
       if(
listitem == 2)//socio
       
{
       }
    }  
//fechando botao ok
   
}//fechando dialog vip
    
return 1;
}
LoadPlayer(playerid)
{
new 
String[128], Nome[MAX_PLAYER_NAME];
GetPlayerName(playeridNomesizeof(Nome));
format(Stringsizeof(String), "SERVER/VIPS/%s.ini"Nome);
    if( 
DOF2_FileExists( String) )
    {
         
        
PlayerInfo[playerid][pVIP] = DOF2_GetIntString"Setado"  ); // Coloca LoadPlayer quando o jogador fazer o loguim dele, ai vai carrega que ele vip 1
    
}
    return 
1;
}
SavePlayer(playerid)
{
new 
String[128], Nome[MAX_PLAYER_NAME];
GetPlayerName(playeridNomesizeof(Nome));
format(Stringsizeof(String), "SERVER/VIPS/%s.ini"Nome);
    if( 
DOF2_FileExists( String ) )
    {
        
DOF2_CreateFile(String);
        
DOF2_SetIntString"Setado"PlayerInfo[playerid][pVIP]); //aqui mostra que o salvamento setado e PlayerInfo[playerid][pVIP]
        
DOF2_SaveFile();
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by Jonorusc
Посмотреть сообщение
Mano eu nгo entendi direito oque vocк queria dizer com esse cуdigo, ai crie um baseado!

PHP код:
//usa um processador de comando e melhor e vou usar dialogs, fica mais bonitinho, mas se nao quiser a base e a mesma!
#include "ocmd" //ou
#include "ZCMD"
#define SendStringMsg(%0,%1,%2,%3) do{new _string[128]; \
format(_string,sizeof(_string),%2,%3); SendClientMessage(%0,%1,_string);} while(False)
#define SendStringMsgToAll(%0,%1,%2) do{new _string[128]; \
format(_string,sizeof(_string),%1,%2); SendClientMessageToAll(%0,_string);} while(False)
new 
False=false;
#define VIPS 1
ocmd:comprarvip(playerid,params[]) //usa o zmcd se quiser

   if(!
IsPlayerConnected(playerid)) return 0;
   if(
PlayerInfo[playerid][pVIP] >= 1) return SendClientMessage(playeridCOLOR_WHITE"Vocк jб possui um VIP ativo."); 
   
VipVaga(); 
   if(
VagaSobrando == 0) return SendClientMessage(playeridCOLOR_WHITE"Nгo possui mais vagas de VIP."); 
   
   
ShowPlayerDialog(playeridVIPSDIALOG_STYLE_LIST"Vips disponiveis""BASIC VIP\n PREMIUM VIP\n SУCIO VIP""Ok""Nгo"); 
   return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
   if(
dialogid == VIPS)
   {
    if(!
response//aqui vocde pode tira o '!' tira o "nгo" do ShowPlayer la, e fica so o response do ok, caso ele aperte esc na hora de escolher, somente ira sai do comando
    
{
        
SendClientMessage(playerid, -1"Vocк cancelou a compra do vip!");
    } 
//fechando botao cancelar
    
else //abrindo botгo ok
    
{
         
/*
         Aqui vocк coloca a variavel dos dias e anos, aqui era vira uma global para o dialog vips, nao precisa criar outras destas aqui
         */
        
if(Mesv == 12 && Anov == 2012) { Mesv 1Anov++;} else { Mesv++; } 
        if(
listitem == 0//basico
       
{
            
/*
                       if (PlayerInfo[playerid][tCash] < 1000) 
                        { 
                            SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo possui '1000' de CASH."); 
                            return 1; 
                        } 
                        creio que seja dinheiro! ent uzarei essa forma de abaixo
            */
            
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playeridCOR_ERROR"ERRO: Vocк nгo tem R$1000 $CASH!");
            
//se ele tiver os 1000 agora nos vai tirar dele, como compra do vip
            
GivePlayerMoney(playerid, -1000);
            
SetPlayerScore(playeridGetPlayerScore(playerid) + 1); //ganhou mais um score, pelo oque eu entendi ai
            //vou criar uma funзгo pra usar strings com variaveis, sem fica criando strings (em cima do gm)
            
new Nome[500]; GetPlayerName(playeridNomesizeof(Nome));
            
SendStringMsgToAll(COR_ERROR"[ VIP ANNCIO ] > O jogador %s acabou de comprar o vip pacote BASICO com 1000 cash!"Nome);
            
SendStringMsg(playerid, -1"Parabйns %s vocк agora й vip"Nome);
            
PlayerInfo[playerid][pVIP] = 1//setando que ele jб e vip no nivel basico = 1
            //aqui vocк coloca o tanto de cash vip etc os dias etc
            
SendStringMsg(playerid, -1"Vocк ganhou %s de cash vip"varial );
            
SendStringMsg(playerid, -1"Vocк ganhou +1 level e foi para o %i "GetPlayerScore(playerid));
            
SendStringMsg(playerid, -1"Vencimento: %d dias %d mкs %d ano %d As %d %d e %d Segundos!"Diav,Mesv,Anov,Horav,Minutov,SegV);
            
SendClientMessage(playerid, -1"Aproveite as funзхes vips /comandosvips"); //comando ficticio 
            
            //e o resto do sistema
            //salva
            /*
            new String[128];
            GetPlayerName(playerid, Nome, sizeof(Nome));
            format(String, sizeof(String), "LOCAL/DO/VIP/%s.ini", Nome); %s vai pega o nome do jogador vip
            */
            
new String[128];
            
GetPlayerName(playeridNomesizeof(Nome));
            
format(Stringsizeof(String), "SERVER/VIPS/%s.ini"Nome); 
           
//coloca a #include dof2 se for usa esse metodo de salvamento, se nao use o preferido
            //e usa DOF2_Exit() no Gamemode exit
            
DOF2_CreateFile(String);
            
DOF2_SetString(String"Pacote""Basico");
            
DOF2_SetInt(String"Setado"); //1 do pacote 1
            //tu coloca pra salvar os dias tbm, mas acho qeu vc ja tem seu salvamento ai, ent tu sabe oque fazer
           //para salva voce pode usar o DOF2_SaveFile mas um jeito mais eu fasso de um jeito mais pratico com stocks
            //com esses dados vocк cria uma checagem pra olha quem passo dos dias de vencimento, caso sim perde o vip etc
 
       
}
       if(
listitem == 1)//premium
       
{
       }
       if(
listitem == 2)//socio
       
{
       }
    }  
//fechando botao ok
   
}//fechando dialog vip
    
return 1;
}
LoadPlayer(playerid)
{
new 
String[128], Nome[MAX_PLAYER_NAME];
GetPlayerName(playeridNomesizeof(Nome));
format(Stringsizeof(String), "SERVER/VIPS/%s.ini"Nome);
    if( 
DOF2_FileExists( String) )
    {
         
        
PlayerInfo[playerid][pVIP] = DOF2_GetIntString"Setado"  ); // Coloca LoadPlayer quando o jogador fazer o loguim dele, ai vai carrega que ele vip 1
    
}
    return 
1;
}
SavePlayer(playerid)
{
new 
String[128], Nome[MAX_PLAYER_NAME];
GetPlayerName(playeridNomesizeof(Nome));
format(Stringsizeof(String), "SERVER/VIPS/%s.ini"Nome);
    if( 
DOF2_FileExists( String ) )
    {
        
DOF2_CreateFile(String);
        
DOF2_SetIntString"Setado"PlayerInfo[playerid][pVIP]); //aqui mostra que o salvamento setado e PlayerInfo[playerid][pVIP]
        
DOF2_SaveFile();
    }
    return 
1;

kkkkkk, eu tinha pego o cmd /darvip e fiz o /comprarvip '-'
sobre o cash ou dinheiro, era cash mesmo.

Vou terminar e testar o que você mandou, obrigado mesmo <3
Reply
#6

Quote:
Originally Posted by gilvanmarques
Посмотреть сообщение
kkkkkk, eu tinha pego o cmd /darvip e fiz o /comprarvip '-'
sobre o cash ou dinheiro, era cash mesmo.

Vou terminar e testar o que vocк mandou, obrigado mesmo <3
Mas tipo pro que for fazer assim jб da certo a base!
e fica mais organizado por dialog
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)