[Ajuda] Sistema de cofre
#1

Eu baixei um sistema de cofre e muito bom e funciona mais ele so funciona quando eu deposito todo dinheiro da minha mao. E na hora de sacar do cofre ele saca toda a quantia que estar no cofre! Queria que funcionasse na quantia que eu determinar nao ela toda =D

PHP код:
    if(strcmp(cmd"/depositar"true) == 0)
    {
        
tmp strtok(cmdtextidx);
        if (
PlayerInfo[playerid][pMember] == 5)
        {
            if(!
strval(tmp)) return  SendClientMessage(playeridGetPlayerColor(playerid), "Use /depositar [dinheiro].");
            if(
strval(tmp) < GetPlayerMoney(playerid)) return SendClientMessage(playeridGetPlayerColor(playerid), "Vocк nгo tem essa quantia");
            if(
PlayerToPoint(RadioballasplayeridLugarCofreballas)){
            
format(stringsizeof(string), "Vocк depositou: %d."strval(tmp));
            
SendClientMessage(playeridGetPlayerColor(playerid), string);
            
Cofreballas += strval(tmp);
            
GivePlayerMoney(playerid,-strval(tmp));
            
dini_IntSet("Cofreballas.ini","Cofreballas",Cofreballas);
            } else 
SendClientMessage(playeridGetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
        }
        return 
1;
    }
    if(
strcmp(cmd"/sacar"true) == 0)
    {
        
tmp strtok(cmdtextidx);
        if (
PlayerInfo[playerid][pLeader] == 5)
        {
            if(!
strval(tmp)) return  SendClientMessage(playeridGetPlayerColor(playerid), "Use /sacar [dinheiro].");
            if(
strval(tmp) < Cofreballas) return SendClientMessage(playeridGetPlayerColor(playerid), "O banco nao tem isso tudo");
            if(
PlayerToPoint(RadioballasplayeridLugarCofreballas)){
            
format(stringsizeof(string), "Vocк Sacou: %d."strval(tmp));
            
SendClientMessage(playeridGetPlayerColor(playerid), string);
            
Cofreballas -= strval(tmp);
               
GivePlayerMoney(playerid,strval(tmp));
               
dini_IntSet("Cofreballas.ini","Cofreballas",Cofreballas);
               }else 
SendClientMessage(playeridGetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
        }
        return 
1;
    } 
Reply
#2

Ola

Ve se e isso ae, se for depois te ajudo com o /sacar

pawn Код:
if(strcmp(cmd, "/depositar", true) == 0)
{
    format(file, sizeof(file), PASTA_CONTAS, PlayerName(playerid));
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if (PlayerInfo[playerid][pMember] == 5)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, GetPlayerColor(playerid), "Use /depositar [quantia].");
            return 1;
        }
        new valor;
        valor = strval(tmp);
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        if(PlayerToPoint(Radioballas, playerid, LugarCofreballas))
        {
            new grana;
            grana = GetPlayerMoney(playerid);
            if(grana > valor-1 && valor > 0)
            {
                format(string, sizeof(string), "(INFO) Vocк depositou a quantia de R$:%d.", valor);
                SendClientMessage(playerid, GetPlayerColor(playerid), string);
                Cofreballas += strval(valor);
                dini_IntSet("Cofreballas.ini","Cofreballas",Cofreballas);
                GivePlayerMoney(playerid, -valor);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, GetPlayerColor(playerid), "(ERRO) Vocк nгo tem todo este dinheiro.");
            }
        }
        else
        }
            SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
        }
    }
    return 1;
}
PT
Reply
#3

Nao deu certo apareceu uma janela assim: O pawno Parou de Funcionar '-'
Reply
#4

pawn Код:
if(strcmp(cmd, "/depositar", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if (PlayerInfo[playerid][pMember] == 5)
        {
            if(!strval(tmp)) return  SendClientMessage(playerid, GetPlayerColor(playerid), "Use /depositar [dinheiro].");
            if(strval(tmp) > GetPlayerMoney(playerid)) return SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo tem essa quantia");
            if(PlayerToPoint(Radioballas, playerid, LugarCofreballas)){
            format(string, sizeof(string), "Vocк depositou: %d.", strval(tmp));
            SendClientMessage(playerid, GetPlayerColor(playerid), string);
            Cofreballas += strval(tmp);
            GivePlayerMoney(playerid,-strval(tmp));
            dini_IntSet("Cofreballas.ini","Cofreballas",Cofreballas);
            } else SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
        }
        return 1;
    }

    if(strcmp(cmd, "/sacar", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if (PlayerInfo[playerid][pLeader] == 5)
        {
            if(!strval(tmp)) return  SendClientMessage(playerid, GetPlayerColor(playerid), "Use /sacar [dinheiro].");
            if(strval(tmp) > Cofreballas) return SendClientMessage(playerid, GetPlayerColor(playerid), "O banco nao tem isso tudo");
            if(PlayerToPoint(Radioballas, playerid, LugarCofreballas)){
            format(string, sizeof(string), "Vocк Sacou: %d.", strval(tmp));
            SendClientMessage(playerid, GetPlayerColor(playerid), string);
            Cofreballas -= strval(tmp);
               GivePlayerMoney(playerid,strval(tmp));
               dini_IntSet("Cofreballas.ini","Cofreballas",Cofreballas);
               }else SendClientMessage(playerid, GetPlayerColor(playerid), "Vocк nгo esta perto do cofre");
        }
        return 1;
    }
Reply
#5

Deu certo =D
VLW
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)