SA-MP Forums Archive
Bizz withdraw help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bizz withdraw help (/showthread.php?tid=384219)



Bizz withdraw help - N0FeaR - 10.10.2012

When i type /withdraw 100 results with this Cannot go under 1 or above 10000000

pawn Код:
}
            if(strcmp(x_nr,"withdraw",true) == 0)
            {
                if(amount == (-1)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /bizz [withdraw] [amount]");
                if(amount < 1 || amount > 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");
                if(PlayerInfo[playerid][pBizzKey] == 255) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You dont own a business.");
                new key = PlayerInfo[playerid][pBizzKey];
                if(strcmp(PlayerName(playerid), BizzInfo[key][bOwner], true) == 0)
                {
                    for(new b = 0; b < sizeof(BizzInfo); b++)
                    {
                        if(IsPlayerInRangeOfPoint(playerid,20.0,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]))
                        {
                            if(BizzInfo[key][bMoney] >= amount)
                            {
                                BizzInfo[key][bMoney] -= amount;
                                GivePlayerPCash(playerid,amount);
                                format(string, sizeof(string), "INFO: You have withdrawed: $%d from your business inventory leaving you with $%d left.", amount, BizzInfo[key][bMoney]);
                                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GREY, "INFO: You dont have that much in your business inventory.");
                            }
                        }
                    }
                }
            }



Re: Bizz withdraw help - ViniBorn - 10.10.2012

Maybe you can use strtok/sscanf before

pawn Код:
if(amount < 1 || amount > 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");



Re: Bizz withdraw help - ToiletDuck - 11.10.2012

pawn Код:
if(amount > 1 || amount < 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");



Re: Bizz withdraw help - N0FeaR - 11.10.2012

pawn Код:
if(strcmp(cmd,"/bizz",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            new x_nr[128], amount;
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr,amount))
            {
                SendClientMessage(playerid, COLOR_GREEN, "HINT: /bizz [info/name/withdraw/deposit/lock/sell/buy]");
                return 1;
            }
            if(strcmp(x_nr,"withdraw",true) == 0)
            {
                if(amount == (-1)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /bizz [withdraw] [amount]");
                if(amount > 1 || amount < 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");
                if(PlayerInfo[playerid][pBizzKey] == 255) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You dont own a business.");
                new key = PlayerInfo[playerid][pBizzKey];
                if(strcmp(PlayerName(playerid), BizzInfo[key][bOwner], true) == 0)
                {
                    for(new b = 0; b < sizeof(BizzInfo); b++)
                    {
                        if(IsPlayerInRangeOfPoint(playerid,20.0,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]))
                        {
                            if(BizzInfo[key][bMoney] >= amount)
                            {
                                BizzInfo[key][bMoney] -= amount;
                                GivePlayerPCash(playerid,amount);
                                format(string, sizeof(string), "INFO: You have withdrawed: $%d from your business inventory leaving you with $%d left.", amount, BizzInfo[key][bMoney]);
                                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GREY, "INFO: You dont have that much in your business inventory.");
                            }
                        }
                    }
                }
            }



Respuesta: Bizz withdraw help - [DOG]irinel1996 - 11.10.2012

pawn Код:
if(strcmp(cmd,"/bizz",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            new x_nr[128], amount;
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr,amount))
            {
                SendClientMessage(playerid, COLOR_GREEN, "HINT: /bizz [info/name/withdraw/deposit/lock/sell/buy]");
                return 1;
            }
            if(strcmp(x_nr,"withdraw",true) == 0)
            {
                if(amount == (-1)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /bizz [withdraw] [amount]");
                if(strval(amount) < 1 || strval(amount) > 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");
                if(PlayerInfo[playerid][pBizzKey] == 255) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You dont own a business.");
                new key = PlayerInfo[playerid][pBizzKey];
                if(strcmp(PlayerName(playerid), BizzInfo[key][bOwner], true) == 0)
                {
                    for(new b = 0; b < sizeof(BizzInfo); b++)
                    {
                        if(IsPlayerInRangeOfPoint(playerid,20.0,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]))
                        {
                            if(BizzInfo[key][bMoney] >= amount)
                            {
                                BizzInfo[key][bMoney] -= amount;
                                GivePlayerPCash(playerid,amount);
                                format(string, sizeof(string), "INFO: You have withdrawed: $%d from your business inventory leaving you with $%d left.", amount, BizzInfo[key][bMoney]);
                                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GREY, "INFO: You dont have that much in your business inventory.");
                            }
                        }
                    }
                }
            }



Re: Bizz withdraw help - ViniBorn - 11.10.2012

Ex:
pawn Код:
new tmp[24]; tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /bizz [withdraw] [amount]");

new amount = strval(tmp);



Re: Bizz withdraw help - N0FeaR - 11.10.2012

Код:
error 035: argument type mismatch (argument 1)
pawn Код:
if(!strlen(amount) < 1 || strval(amount) > 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");



Re: Bizz withdraw help - ViniBorn - 11.10.2012

pawn Код:
new amount = strval(tmp);
if(amount < 1 || amount > 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");



Re: Bizz withdraw help - N0FeaR - 11.10.2012

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
pawn Код:
new amount = strval(tmp);
if(amount < 1 || amount > 10000000) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Cannot go under 1 or above 10000000.");
Got still same problem Results with cannot go under 1 blala.


Re: Bizz withdraw help - HyDrAtIc - 11.10.2012

Maybe?

pawn Код:
if(!strlen(amount) < 1 || strval(amount) > 10000000) return SendClientMessage(playerid, COLOR_GREY,"SERVER: Cannot go under 1 or above 10000000.");