PayDay
#1

Hello
I wanted to know how to make an PayDay witch give players 100 Dollars each day at 6:00 AM
But the players should be in Bank/Atm or they won't receive it
Reply
#2

..................up
Reply
#3

pawn Код:
new hour, minute;
GetPlayerTime(playerid, hour, minute);
if(hour == 6 && minute == 0 && GetPlayerInterior(playerid) == BANK_INTERIOR_ID_GOES_HERE)
{
   GivePlayerMoney(playerid, 100);
}
Not entirely sure about detecting whether or not the player is near an ATM.
Reply
#4

Quote:
Originally Posted by MellowHammer
Посмотреть сообщение
pawn Код:
new hour, minute;
GetPlayerTime(playerid, hour, minute);
if(hour == 6 && minute == 0 && GetPlayerInterior(playerid) == BANK_INTERIOR_ID_GOES_HERE)
{
   GivePlayerMoney(playerid, 100);
}
Not entirely sure about detecting whether or not the player is near an ATM.
Simply for the ATM:

pawn Код:
if IsPlayerInRangeOfPoint(playerid, 3, atmX, atmY, atmZ)
{
    if(PaydayPassed[playerid] == 1)
    { // define this somewhere: "new PaydayPassed[MAX_PLAYERS];" and when it's payday set the value to one, then after 40 mins set it to 0.
        SendClientMessage(playerid, -1, "You have a cheque awaiting you from the last payday, pick it up!");
        GivePlayerMoney(playerid, 100);
    }
}
Reply
#5

We're not magicians to find out more details/in-depth about your ATM/bank system
Reply
#6

Quote:
Originally Posted by MellowHammer
Посмотреть сообщение
pawn Код:
new hour, minute;
GetPlayerTime(playerid, hour, minute);
if(hour == 6 && minute == 0 && GetPlayerInterior(playerid) == BANK_INTERIOR_ID_GOES_HERE)
{
   GivePlayerMoney(playerid, 100);
}
Not entirely sure about detecting whether or not the player is near an ATM.
This will fuck the PayDay system.

First of all create a variable top of the script.

pawn Код:
new pd_cash[MAX_PLAYERS]
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    pd_cash[playerid] = 0;
    return 1;
}
The important thing change your game time system in a variable.

pawn Код:
static hour, minute;
pawn Код:
public OnGameModeInit()
{
    SetTimer("UpdateTime", 1000, 1);
    return 1;
}

forward UpdateTime();
public UpdateTime()
{
    minute++;

    if (minute == 60)
    {
        hour++;

        if(hour == 0)
        {
            hour = 0;
        }
    }

    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetPlayerTime(i, hour, minute);
           
            if(hour == 6 && minute == 0)
            {
                pd_cash[i] += 100;
            }
        }
    }
}
pawn Код:
public OnPlayerConnect(playerid)
{
    TogglePlayerClock(playerid, 1);
    return 1;
}
pawn Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    if(newinteriorid == BANK_INTERIOR && GetPlayerVirtualWorld(playerid) == BANK_VIRTUAL_WORLD)
    {
        GivePlayerMoney(playerid, pd_cash[playerid]);
        pd_cash[playerid] = 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)