SA-MP Forums Archive
Where i wrong this payday code - 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: Where i wrong this payday code (/showthread.php?tid=424441)



Where i wrong this payday code - MrTinder - 22.03.2013

Hi.I wanna when it's xx:00 all players to get Exp,Money and etc.I make code but no one get payday.
pawn Код:
forward PayDay();
public PayDay()
{
    gettime(hour, minute);
    if(minute == 20)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
                         if(PlayerInfo[i][pDonateRank] > 4)
                         {
                            GivePlayerMoney(i,30000);
                            PlayerInfo[i][Exp] += 3;
                         }
                         if(PlayerInfo[i][pDonateRank] < 4)
                         {
                            new String[2000];
                            new nxtlevel = PlayerInfo[i][Level];
                            new payday = nxtlevel*0;
                            GivePlayerMoney(i,payday);
                            PlayerInfo[i][Exp]++;
                            GameTextForPlayer(i,"~p~ PayDay",6,5000);
                            format(String, sizeof(String), "Взети пари:%d $", payday);
                            SendClientMessage(i,COLOR_GREEN,String);
                            if(PlayerInfo[i][pMember] == TEAM_BALLAS && PlayerInfo[i][pRank] == 6)
                            {
                                GivePlayerMoney(i,10000);
                                PlayerInfo[i][Exp] += 6;
                                SendClientMessage(i,COLOR_GREEN,"Rolling Height Ballas:6 Exp,$10000");
                            }
                            if(PlayerInfo[i][pMember] == TEAM_BRAIN && PlayerInfo[i][pRank] == 1)
                            {
                                GivePlayerMoney(i,2000);
                                PlayerInfo[i][Exp] += 2;
                                SendClientMessage(i,COLOR_GREEN,"No Brain:2 Exp,$2000");
                            }
                            if(PlayerInfo[i][pMember] == TEAM_BRAIN && PlayerInfo[i][pRank] == 2)
                            {
                                GivePlayerMoney(i,3000);
                                PlayerInfo[i][Exp] += 3;
                                SendClientMessage(i,COLOR_GREEN,"No Brain:3 Exp,$3000");
                            }
                            if(PlayerInfo[i][pMember] == TEAM_BRAIN && PlayerInfo[i][pRank] == 3)
                            {
                                GivePlayerMoney(i,4000);
                                PlayerInfo[i][Exp] += 4;
                                SendClientMessage(i,COLOR_GREEN,"No Brain:4 Exp,$4000");
                            }
                            if(PlayerInfo[i][pMember] == TEAM_BRAIN && PlayerInfo[i][pRank] == 4)
                            {
                                GivePlayerMoney(i,5000);
                                PlayerInfo[i][Exp] += 5;
                                SendClientMessage(i,COLOR_GREEN,"No Brain:5 Exp,$5000");
                            }
                            if(PlayerInfo[i][pMember] == TEAM_BRAIN && PlayerInfo[i][pRank] == 5)
                            {
                                GivePlayerMoney(i,6000);
                                PlayerInfo[i][Exp] += 6;
                                SendClientMessage(i,COLOR_GREEN,"No Brain:6 Exp,$6000");
                            }
                            if(PlayerInfo[i][pMember] == TEAM_BRAIN && PlayerInfo[i][pRank] == 6)
                            {
                                GivePlayerMoney(i,15000);
                                PlayerInfo[i][Exp] += 8;
                                SendClientMessage(i,COLOR_GREEN,"No Brain:8 Exp,$15000");
                            }
                            SendClientMessage(i,COLOR_GREEN,"Взето Exp:1 Exp");
                            format(String, sizeof(String), "Нова обща сума:%d $", PlayerInfo[i][pCash]);
                            SendClientMessage(i,COLOR_GREEN,String);


                }
        }
    }

}



Re: Where i wrong this payday code - LarzI - 22.03.2013

Well if everyone's pDonateRank equals 4 then there's no wonder why it won't work. Use 'else'.
Other than that I can't really see anything wrong.


Re: Where i wrong this payday code - MrTinder - 22.03.2013

I make it else but still this problem.


Re: Where i wrong this payday code - LarzI - 22.03.2013

Debug the code. https://sampwiki.blast.hk/wiki/Debugging


Re: Where i wrong this payday code - MrTinder - 22.03.2013

I try before...


Re: Where i wrong this payday code - MrTinder - 22.03.2013

help please


Re: Where i wrong this payday code - MrTinder - 23.03.2013

please help me ..


Re: Where i wrong this payday code - [ABK]Antonio - 23.03.2013

pawn Код:
forward PayDay();
public PayDay()
{
    gettime(hour, minute);
    if(minute == 00) //you said you want on 00 so i changed to that instead of 20
    {
        new ExpGain, MoneyGain;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue; //skip this iteration since they aren't connected
           
            if(PlayerInfo[i][pDonateRank] > 4)
            {
                GivePlayerMoney(i,30000);
                PlayerInfo[i][Exp] += 3; //you know this is going to short the players with rank 3+ on their team or w/e right
            }
            else
            {
                new String[128],
                    nxtlevel = PlayerInfo[i][Level],
                    payday = nxtlevel*0; //this is always going to be 0...when you multiply any number by 0, it becomes 0
                GivePlayerMoney(i,payday); //will give them $0 because of the reason said above
                PlayerInfo[i][Exp]++;
                GameTextForPlayer(i,"~p~ PayDay",6,5000);
                format(String, sizeof(String), "????? ????:%d $", payday);
                SendClientMessage(i,COLOR_GREEN,String);
               
                if(PlayerInfo[i][pMember] == TEAM_BALLAS && PlayerInfo[i][pRank] == 6)
                {
                    GivePlayerMoney(i,10000);
                    PlayerInfo[i][Exp] += 6;
                    SendClientMessage(i,COLOR_GREEN,"Rolling Height Ballas:6 Exp,$10000");
                }
               
                if(PlayerInfo[i][pMember] == TEAM_BRAIN)
                {
                    if(PlayerInfo[i][pRank]==6)
                    {
                        MoneyGain=15000;
                        ExpGain=8;
                    }
                    else //Below is the same thing you were doing before basically just a bit better on the eyes
                    {
                        ExpGain=PlayerInfo[i][pRank]+1;
                        MoneyGain=ExpGain*1000;
                    }
                    GivePlayerMoney(i, MoneyGain);
                    new string[128];
                    format(string, sizeof(string), "No Brain: %i Exp, $%i", ExpGain, MoneyGain);
                    SendClientMessage(i,COLOR_GREEN,string);
                }
                //Idk what this part is for
                SendClientMessage(i,COLOR_GREEN,"????? Exp:1 Exp");
                format(String, sizeof(String), "???? ???? ????:%d $", PlayerInfo[i][pCash]);
                SendClientMessage(i,COLOR_GREEN,String);
            }
        }
    }
}
I left the unsupported characters in there (unsupported cause i dont got installed lol)...You might have to change them or somethin idk, can't understand it lol

Try this out though (change 00 to whatever the next minute is for you or somethin)


Re: Where i wrong this payday code - MrTinder - 23.03.2013

now when it's xx:00 the clock disapears


Re: Where i wrong this payday code - MrTinder - 30.03.2013

new problem...Now when it's xx:59 time freez and when real time get xx:01 ingame time skip xx:00 and becomes xx:01.Please help ..