Bug in deposit!
#1

when I use /deposit -10 I can get +10
Can someone explain me?
Sorry for my bad english!

Код:
	if(strcmp(cmd, "/Depositar", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(IsPlayerInRangeOfPoint(playerid,5.0,BankPosition[X],BankPosition[Y],BankPosition[Z]))
	        {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /Depositar [Quantidade]");
					return 1;
				}
				new cashdeposit = strval(tmp);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /Depositar [Quantidade]");
					return 1;
				}
				if(GetPlayerCash(playerid) >= cashdeposit)
				{
					GivePlayerCash(playerid,-cashdeposit);
					PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
					format(string, sizeof(string), "[Info:] Depositaste $%d, Novo balanзo: $%d", cashdeposit,PlayerInfo[playerid][pBank]);
					SendClientMessage(playerid, COLOR_WHITE, string);
                    PlayerActionMessage(playerid,15.0,"Entrega algum dinheiro ao banqueiro.");
                    OnPlayerDataSave(playerid);
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "[Erro:] Nгo tens esse dinheiro todo!");
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "[Erro:] Nгo estas no banco!");
			}
		}
		return 1;
	}
Reply
#2

i change
Код:
PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
to
Код:
PlayerInfo[playerid][pBank] += cashdeposit;
Continue with bug
Reply
#3

pawn Код:
if(strcmp(cmd, "/Depositar", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,BankPosition[X],BankPosition[Y],BankPosition[Z]))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /Depositar [Quantidade]");
                return 1;
            }
            new cashdeposit = strval(tmp);
            if(cashdeposit < 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "[Erro:] Invalid value!");
                return 1;
            }
            if(GetPlayerCash(playerid) >= cashdeposit)
            {
                GivePlayerCash(playerid,-cashdeposit);
                PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
                format(string, sizeof(string), "[Info:] Depositaste $%d, Novo balan?o: $%d", cashdeposit,PlayerInfo[playerid][pBank]);
                SendClientMessage(playerid, COLOR_WHITE, string);
                PlayerActionMessage(playerid,15.0,"Entrega algum dinheiro ao banqueiro.");
                OnPlayerDataSave(playerid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "[Erro:] N?o tens esse dinheiro todo!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "[Erro:] N?o estas no banco!");
        }
        return 1;
    }
Reply
#4

Work's Thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)