PayDay - 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: PayDay (
/showthread.php?tid=453927)
PayDay -
KimSangBum - 27.07.2013
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
Re : PayDay -
KimSangBum - 27.07.2013
..................up
Re: PayDay -
MellowHammer - 27.07.2013
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.
Re: PayDay -
Mitchy - 27.07.2013
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);
}
}
Re: PayDay -
Sublime - 27.07.2013
We're not magicians to find out more details/in-depth about your ATM/bank system
AW: Re: PayDay -
Skimmer - 27.07.2013
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 Код:
public OnPlayerDisconnect(playerid, reason)
{
pd_cash[playerid] = 0;
return 1;
}
The important thing change your game time system in a variable.
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;
}