[Ajuda] Comando /sacar
#1

Seguinte, tгo entrando no meu servidor digitando "/sacar -100000000" Varias vezes e depois de tal vezes ex 5

a grana negativa comeзa a ficar positiva e o player fica com grana maior que qualquer coisa..

PHP код:
if(strcmp(cmd"/sacar"true) == 0)
{
    
format(filesizeof(file), PASTA_CONTASPlayerName(playerid));
    new 
checknome;
    new 
tmp[256];
    
checknome CPS_GetPlayerCheckpoint(playerid);
    if(
checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridVermelho"Use /sacar [quantia].");
        }
        new 
valor;
        
valor strval(tmp);
        new 
aname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridanameMAX_PLAYER_NAME);
        if(
dini_Int(file"ContaBancaria") == 1)
        {
        if(
dini_Int(file"SaldoBancario") > valor+1)
            {
            
format(stringsizeof(string), "(INFO) Bancos new world: Vocк sacou a quantia de R$%d."valor);
            
SendClientMessage(playeridVerdestring);
            
dini_IntSet(file"SaldoBancario"dini_Int(file"SaldoBancario")-valor);
            
GivePlayerGrana(playeridvalor);
            return 
1;
            }
            else
            {
            
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem todo este dinheiro.");
            }
        }
        else
        {
        
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {
    
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo estб em um Banco.");
    }

Ai o code, por favor ajudem
Reply
#2

pawn Код:
if(strcmp(cmd, "/sacar", true) == 0)
{
    format(file, sizeof(file), PASTA_CONTAS, PlayerName(playerid));
    new checknome;
    new tmp[256];
    checknome = CPS_GetPlayerCheckpoint(playerid);
    if(checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {

            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        if(tmp < 0)
        {
            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        new valor;
        valor = strval(tmp);
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        if(dini_Int(file, "ContaBancaria") == 1)
        {

            if(dini_Int(file, "SaldoBancario") > valor+1)
            {

                format(string, sizeof(string), "(INFO) Bancos new world: Vocк sacou a quantia de R$%d.", valor);
                SendClientMessage(playerid, Verde, string);
                dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")-valor);
                GivePlayerGrana(playerid, valor);
                return 1;
            }
            else
            {

                SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem todo este dinheiro.");
            }

        }
        else
        {

            SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {

        SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo estб em um Banco.");
    }
}
Tente.
Reply
#3

Quote:
Originally Posted by Murilo_sousa
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/sacar", true) == 0)
{
    format(file, sizeof(file), PASTA_CONTAS, PlayerName(playerid));
    new checknome;
    new tmp[256];
    checknome = CPS_GetPlayerCheckpoint(playerid);
    if(checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {

            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        if(tmp < 0) // linha do erro aki
        {
            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        new valor;
        valor = strval(tmp);
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        if(dini_Int(file, "ContaBancaria") == 1)
        {

            if(dini_Int(file, "SaldoBancario") > valor+1)
            {

                format(string, sizeof(string), "(INFO) Bancos new world: Vocк sacou a quantia de R$%d.", valor);
                SendClientMessage(playerid, Verde, string);
                dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")-valor);
                GivePlayerGrana(playerid, valor);
                return 1;
            }
            else
            {

                SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem todo este dinheiro.");
            }

        }
        else
        {

            SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {

        SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo estб em um Banco.");
    }
}
Tente.
Erro:
(5997) : error 033: array must be indexed (variable "tmp")

Linha do erro

PHP код:
if(strcmp(cmd"/sacar"true) == 0)
{
    
format(filesizeof(file), PASTA_CONTASPlayerName(playerid));
    new 
checknome;
    new 
tmp[256];
    
checknome CPS_GetPlayerCheckpoint(playerid);
    if(
checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridVermelho"Use /sacar [quantia].");
        }
        if(
tmp 0// linha do erro aki <
        
{
            
SendClientMessage(playeridVermelho"Use /sacar [quantia].");
        }
        new 
valor;
        
valor strval(tmp);
        new 
aname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridanameMAX_PLAYER_NAME);
        if(
dini_Int(file"ContaBancaria") == 1)
        {
            if(
dini_Int(file"SaldoBancario") > valor+1)
            {
                
format(stringsizeof(string), "(INFO) Bancos new world: Vocк sacou a quantia de R$%d."valor);
                
SendClientMessage(playeridVerdestring);
                
dini_IntSet(file"SaldoBancario"dini_Int(file"SaldoBancario")-valor);
                
GivePlayerGrana(playeridvalor);
                return 
1;
            }
            else
            {
                
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem todo este dinheiro.");
            }
        }
        else
        {
            
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {
        
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo estб em um Banco.");
    }

Reply
#4

Erro meu sorry

Tente agora


pawn Код:
if(strcmp(cmd, "/sacar", true) == 0)
{
    format(file, sizeof(file), PASTA_CONTAS, PlayerName(playerid));
    new checknome;
    new tmp[256];
    checknome = CPS_GetPlayerCheckpoint(playerid);
    if(checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {

            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        if(strval(tmp) < 0)
        {
            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        new valor;
        valor = strval(tmp);
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        if(dini_Int(file, "ContaBancaria") == 1)
        {

            if(dini_Int(file, "SaldoBancario") > valor+1)
            {

                format(string, sizeof(string), "(INFO) Bancos new world: Vocк sacou a quantia de R$%d.", valor);
                SendClientMessage(playerid, Verde, string);
                dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")-valor);
                GivePlayerGrana(playerid, valor);
                return 1;
            }
            else
            {

                SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem todo este dinheiro.");
            }

        }
        else
        {

            SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {

        SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo estб em um Banco.");
    }
}
Reply
#5

Murilo, Compilar compilou porem o erro continua
boto, /sacar -10000000 e vai ..

PHP код:
if(strcmp(cmd"/sacar"true) == 0)
{
    
format(filesizeof(file), PASTA_CONTASPlayerName(playerid));
    new 
checknome;
    new 
tmp[256];
    
checknome CPS_GetPlayerCheckpoint(playerid);
    if(
checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {

            
SendClientMessage(playeridVermelho"Use /sacar [quantia].");
        }
        if(
strval(tmp) < 0)
        {
            
SendClientMessage(playeridVermelho"Use /sacar [quantia].");
        }
        new 
valor;
        
valor strval(tmp);
        new 
aname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridanameMAX_PLAYER_NAME);
        if(
dini_Int(file"ContaBancaria") == 1)
        {

            if(
dini_Int(file"SaldoBancario") > valor+1)
            {

                
format(stringsizeof(string), "(INFO) Bancos new world: Vocк sacou a quantia de R$%d."valor);
                
SendClientMessage(playeridVerdestring);
                
dini_IntSet(file"SaldoBancario"dini_Int(file"SaldoBancario")-valor);
                
GivePlayerGrana(playeridvalor);
                return 
1;
            }
            else
            {

                
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem todo este dinheiro.");
            }

        }
        else
        {

            
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {

        
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo estб em um Banco.");
    }

Reply
#6

pawn Код:
if(dini_Int(file, "SaldoBancario") > valor<=1) return SendClientMessage(playerid, 0xFF0000FF, "Nгo dб pra sacar menos de $1");
Reply
#7

Continou o erro, Code:

PHP код:
if(strcmp(cmd"/sacar"true) == 0)
{
    
format(filesizeof(file), PASTA_CONTASPlayerName(playerid));
    new 
checknome;
    new 
tmp[256];
    
checknome CPS_GetPlayerCheckpoint(playerid);
    if(
checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {

            
SendClientMessage(playeridVermelho"Use /sacar [quantia].");
        }
        if(
strval(tmp) < 0)
        {
            
SendClientMessage(playeridVermelho"Use /sacar [quantia].");
        }
        new 
valor;
        
valor strval(tmp);
        new 
aname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridanameMAX_PLAYER_NAME);
        if(
dini_Int(file"ContaBancaria") == 1)
        {

            if(
dini_Int(file"SaldoBancario") > valor<=1)
            {

                
format(stringsizeof(string), "(INFO) Banco Vida Virtual: Vocк sacou a quantia de R$%d."valor);
                
SendClientMessage(playeridVerdestring);
                
dini_IntSet(file"SaldoBancario"dini_Int(file"SaldoBancario")-valor);
                
GivePlayerGrana(playeridvalor);
                return 
1;
            }
            else
            {

                
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem todo este dinheiro.");
            }

        }
        else
        {

            
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {

        
SendClientMessage(playeridVermelho"(ERRO) Vocк nгo estб em um Banco.");
    }

Reply
#8

Era pra vocк adicionar a funзгo, nгo altera-lб.
Coloque a funзгo anterior do comando e adicione a que lhe mandei.
Reply
#9

Tente,

o valor tem que ser embaixo dos new


pawn Код:
if(strcmp(cmd, "/sacar", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, PlayerName(playerid));
    new checknome;
    new tmp[256];
    checknome = CPS_GetPlayerCheckpoint(playerid);
    if(checknome == caixaeletronico1 || checknome == caixaeletronico2 || checknome == caixaeletronico3 || checknome == caixaeletronico4 || checknome == caixaeletronico5 || checknome == caixaeletronico6 || checknome == caixaeletronico7 || checknome == caixaeletronico8 || checknome == bancoPref)
    {
        tmp = strtok(cmdtext, idx);
        new valor;
        valor = strval(tmp);
        if(!strlen(tmp))
        {

            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        if(strval(tmp) < 0)
        {
            SendClientMessage(playerid, Vermelho, "Use /sacar [quantia].");
        }
        if(dini_Int(file, "ContaBancaria") == 1)
        {

            if(dini_Int(file, "SaldoBancario") > valor<=1)
            {

                format(string, sizeof(string), "(INFO) Banco Vida Virtual: Vocк sacou a quantia de R$%d.", valor);
                SendClientMessage(playerid, Verde, string);
                dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")-valor);
                GivePlayerGrana(playerid, valor);
                return 1;
            }
            else
            {

                SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem todo este dinheiro.");
            }

        }
        else
        {

            SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem uma conta bancбria.");
        }
    }
    else
    {

        SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo estб em um Banco.");
    }
}
Reply
#10

Bom na verdade, Eu Botei 1° O que vocк recomendou Miqueias, Porem deu erro na linha do else else
{

SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem todo este dinheiro.");
}

eu o tirei, e entrei, e comeзou a pegar grana que nгo tinha no banco.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)