Payday Help
#1

Hello, I don't understand why it doesn't call payday every o clock.

pawn Code:
new tsec,tmin,thour;
Under OnGameModeInIt:

pawn Code:
SetTimer("Clock",900,true);
pawn Code:
forward Clock();
public Clock()
{
    new string[128];
    gettime(thour, tmin, tsec);
    new Day, Month, Year;
    getdate(Year, Month, Day);
    foreach(Player, i)
    {
        if (thour < 10 && tmin < 10 && tsec < 10 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: 0%d:0%d:0%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
        if (tmin > 9 && thour > 9 && tsec > 9 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: %d:%d:%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
        if (thour < 10 && tmin > 9 && tsec > 9 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: 0%d:%d:%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
        if (tmin < 10 && thour > 9 && tsec > 9 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: %d:0%d:%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
        if (tmin > 9 && thour < 10 && tsec < 10 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: 0%d:%d:0%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
        if (tmin < 10 && thour < 10 && tsec > 9 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: 0%d:0%d:%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
        if (thour > 9 && tmin > 9 && tsec < 10 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: %d:%d:0%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
        if (tmin < 10 && thour > 9 && tsec < 10 && PlayerInfo[i][pWatch])
        {
            format(string, sizeof(string), "~y~Time~w~: %d:0%d:0%d", thour, tmin, tsec);
            TextDrawSetString(TimeTD, string);
            return 1;
        }
    }
    if (tmin == 0 && tsec <= 4) // PayDay
    {
            SetWorldTime(thour);
            PayDay();
    }
    return 1;
}
Then I have the payday function:

pawn Code:
stock PayDay()
{
    foreach(Player, i)
    {
        new string[128];
        new rentprice = PlayerInfo[i][pPayDayRent];
        new benefits = 300;
        if(IsPlayerLoggedIn(i))
        {
            SendClientMessage(i, COLOR_GREEN, "---------------------------------");
            format(string, sizeof(string), "%s Pay Check - Direct Deposit", GetName(i));
            SendClientMessage(i, COLOR_WHITE, string);
            SendClientMessage(i, COLOR_GREEN, "---------------------------------");
            format(string, sizeof(string), "Unemployed Benefits{FFFFFF}: +$%d", benefits);
            SendClientMessage(i, COLOR_GREEN, string);
            if(PlayerInfo[i][pRenting] > 0)
            {
                format(string, sizeof(string), "House Rent{FFFFFF}: -$%d", rentprice);
                SendClientMessage(i, COLOR_GREEN, string);
                PlayerInfo[i][pBank] += benefits-rentprice;
            }
            else
            {
                PlayerInfo[i][pBank] += benefits;
            }
            format(string, sizeof(string), "New Bank Balance{FFFFFF}: $%d", PlayerInfo[i][pBank]);
            SendClientMessage(i, COLOR_GREEN, string);
            SetWeather(45);
            return 1;
        }
    }
    return 1;
}
Reply


Messages In This Thread
Payday Help - by AphexCCFC - 12.01.2013, 18:44

Forum Jump:


Users browsing this thread: 1 Guest(s)