SA-MP Forums Archive
/signcheck problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /signcheck problem (/showthread.php?tid=215660)



/signcheck problem - BizzyD - 23.01.2011

Hello, i got a problem with my payday system. When it gets payday time. And we have to do /signcheck. But the money dosent get into the bank account. It dosent update at all.

Here is my code:
pawn Код:
if(strcmp(cmd, "/signcheck", true) == 0)
    {
        //new string[128];
        new account,interest;
        if(!strlen(cmdtext[11]))
        {
            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /signcheck [check number]");
            return 1;
        }
        new number = strval(cmdtext[11]);
        if(number < 1000 || number > 9999) { SendClientMessage(playerid, COLOR_GREY, " You can't use that check number"); return 1; }
        if(number == CheckNumber[playerid])
        {
            //new sendername[MAX_PLAYER_NAME];
            new tmpintrate = 1; //interest rate
            new viptmpintrate = 2; // vip interest rate
            //if(PlayerInfo[playerid][pHouseAccepted] == 1){ tmpintrate = 2; }
            if(PlayerInfo[playerid][pDonateRank] == 1){ tmpintrate = 2; }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            account = PlayerInfo[playerid][pAccount]; //bank account amount
            if(PlayerInfo[playerid][pPayDay] >= 5)
            {
                new checks = PlayerInfo[playerid][pPayCheck]; //paycheck amount
                new incometax = PlayerInfo[playerid][pPayCheck] / 100 * Tax; //income tax amount
                PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+checks-incometax; //give money
                GivePlayerMoney(playerid, checks-incometax); //give money
                //TAX MONEY
                TaxValue = TaxValue+incometax;
                //ELECTRICITY
                new randomv = random(1000);
                new ebill = (randomv*PlayerInfo[playerid][pHouseLevel])/2;
                if(PlayerInfo[playerid][pHouseLevel] && PlayerInfo[playerid][pHouseAccepted])
                {
                    PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-ebill; //give money
                    GivePlayerMoney(playerid, -ebill); //give money
                }
                //INTEREST

                if(VIPGold[playerid] != 1)
                {
                interest = (PlayerInfo[playerid][pAccount]/1000)*(tmpintrate); //bank interest
                PlayerInfo[playerid][pAccount] = account+interest; //add interest money to bank
                }
                else if(VIPGold[playerid] == 1)
                {
                interest = (PlayerInfo[playerid][pAccount]/1000)*(viptmpintrate);//bank vip interest
                PlayerInfo[playerid][pAccount] = account+interest; //add interest money to bank
                }
                //EXP
                PlayerInfo[playerid][pExp]++; //experience points
                SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATEMENT ___|");
                format(string, sizeof(string), "  Paycheck: $%d", checks);
                SendClientMessage(playerid, COLOR_GRAD1, string);
                format(string, sizeof(string), "  Income Tax: -$%d", incometax);
                SendClientMessage(playerid, COLOR_GRAD1, string);
                if(PlayerInfo[playerid][pHouseLevel] && PlayerInfo[playerid][pHouseAccepted])
                {
                    format(string, sizeof(string), "  Electricity Bill: -$%d", ebill);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
                format(string, sizeof(string), "  Balance: $%d", account);
                SendClientMessage(playerid, COLOR_GRAD1, string);
                format(string, sizeof(string), "  Interest Rate: 0.%d percent",tmpintrate);
                SendClientMessage(playerid, COLOR_GRAD2, string);
                format(string, sizeof(string), "  Interest Gained $%d", interest);
                SendClientMessage(playerid, COLOR_GRAD3, string);
                SendClientMessage(playerid, COLOR_GRAD4, "|------------------------------------------|");
                format(string, sizeof(string), "  New Balance: $%d", PlayerInfo[playerid][pAccount]);
                SendClientMessage(playerid, COLOR_GRAD5, string);
                format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
                GameTextForPlayer(playerid, string, 5000, 1);
                PlayerInfo[playerid][pPayDay] = 0;
                PlayerInfo[playerid][pPayCheck] = 0;
                PlayerInfo[playerid][pConnectTime] += 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "* You haven't played long enough to obtain a Paycheck.");
            }
        }
    }
Thanks, Alex

EDIT: Here is a picture where you can see that the bank account dosent update.




Re: /signcheck problem - BizzyD - 24.01.2011

Anyone knows?


Re: /signcheck problem - Fool - 24.01.2011

huh, You did

//new string[128];


Re: /signcheck problem - BizzyD - 24.01.2011

Quote:
Originally Posted by Porsche911
Посмотреть сообщение
huh, You did

//new string[128];
Yea, why?


Re: /signcheck problem - Fool - 24.01.2011

EDIT: It must be like This

Remove : //new string[128];
new account,interest;

Do :
new string[128], account, interest;


Re: /signcheck problem - BizzyD - 24.01.2011

Ahh okey! thank you Gonna check if it works soon


Re: /signcheck problem - BizzyD - 24.01.2011

Well, now i get this warning:
Код:
local variable "string" shadows a variable at a preceding level
And it still dosent work, look here:



Re: /signcheck problem - alpha500delta - 24.01.2011

Its the same pic LOL


Re: /signcheck problem - BizzyD - 24.01.2011

i just added the one at first post ^^


Re: /signcheck problem - und3rcore - 24.01.2011

What the hell did you change from it ?