Help with 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with PayDay (
/showthread.php?tid=197055)
Help with PayDay -
Ivica_Razor - 07.12.2010
Eh like to go ... I want to make my payday comes every 30 minutes, I tried with a timer but nejde, if you'd like me to have someone help you or show? Thanks in advance
Re: Help with PayDay -
Ivica_Razor - 07.12.2010
Please, anyone?
Re: Help with PayDay -
Mehtab - 07.12.2010
same to me
Re: Help with PayDay -
JamesC - 07.12.2010
pawn Код:
// Top
forward PayDay( ); // Forwarding the function
// OnGameModeInit
SetTimer( "PayDay", 1800000, true ); // Setting the timer to call every 30 minutes (1.8 million milliseconds)
// Outside callbacks
public PayDay( )
{
for( new i; i < MAX_PLAYERS; i++ ) // Can be substituted with foreach (Recommended)
{
if( IsPlayerConnected( i ) // Is the player connected?
{
GivePlayerMoney( i, 5000 ); // Give the player some money
}
}
}
Untested, please forgive me if I missed anything.
Re: Help with PayDay -
Ivica_Razor - 07.12.2010
Quote:
Originally Posted by JamesC
pawn Код:
// Top forward PayDay( ); // Forwarding the function
// OnGameModeInit SetTimer( "PayDay", 1800000, true ); // Setting the timer to call every 30 minutes (1.8 million milliseconds)
// Outside callbacks public PayDay( ) { for( new i; i < MAX_PLAYERS; i++ ) // Can be substituted with foreach (Recommended) { if( IsPlayerConnected( i ) // Is the player connected? { GivePlayerMoney( i, 5000 ); // Give the player some money } } }
Untested, please forgive me if I missed anything.
|
omg omg i'm very very big bot
tnx man
Re: Help with PayDay -
Ivica_Razor - 07.12.2010
I made that payday comes every 30 minutes, but now I was going testata come when those 30 minutes to write I have not played long enough, how to set up that has played 15 minutes of those 30 to payday?
http://slike.hr/slike/s/samp088_bd0c0.png
Re: Help with PayDay -
JamesC - 07.12.2010
pawn Код:
// Top of script
new
CurrentSession[ MAX_PLAYERS ] // Create an array which keeps track of how many seconds the player has been on the server.
;
forward PayDay( ); // Forwarding the payday function.
forward ThreeSecondTimer( ); // Forwarding the session increment function.
// OnGameModeInit
SetTimer( "PayDay", 1800000, true ); // Setting the payday timer for 30 minutes.
SetTimer( "ThreeSecondTimer", 3000, true ); // Setting the session timer for 3 seconds.
// OnPlayerConnect
CurrentSession[ playerid ] = 0; // When a new player connects, their session time should be 0.
// Outside callbacks
public ThreeSecondTimer( )
{
for( new i; i < MAX_PLAYERS; i++ ) // Can be substituted with foreach (Recommended)
{
if( IsPlayerConnected( i ) ) // If the player is connected
{
CurrentSession[ i ] += 3; // Add 3 to their seconds connected.
}
}
return 1;
}
public PayDay( )
{
for( new i; i < MAX_PLAYERS; i++ ) // Can be substituted with foreach (Recommended)
{
if( IsPlayerConnected( i ) ) // If the player is connected
{
if( CurrentSession[ i ] >= 900 ) // If the player has been connected for at least 15 minutes.
{
GivePlayerMoney( i, 5000 ); // Give the player money
}
else
{
SendClientMessage( i, 0xFFFFFFFF, "Server: You haven't played long enough!" ); // The player has not been connected for at least 15 minutes.
}
CurrentSession[ i ] = 0; // Reset the session.
}
}
return 1;
}
Untested, I'm sure there are more efficient ways of doing this but I feel this is the easiest way to explain how it works.
Re: Help with PayDay -
Ivica_Razor - 07.12.2010
but I use the GF mode (I know sucks) but nezz who set the timer to be 15 min you to be online to get payday mos only other way instead of "sendClientMessage to put the payday, but then you still have it: S. .. even someone knows Let help
Re: Help with PayDay -
fangoth1 - 08.12.2010
this may/may not work
pawn Код:
SetTimerEx("payday", time, true, "d", playerid);//time has to be defined
, but it should its what i use
pawn Код:
public payday(playerid)
{
GameTextForPlayer(playerid, "PAYDAY!!!", 10000, 3);
SendClientMessage(playerid, YOUR_COLOR_HERE, "YOUR MESSAGE");
GivePlayerMoney(playerid, 5000);// or whatever you want
return 1;
}
Re: Help with PayDay -
Ivica_Razor - 08.12.2010
Quote:
Originally Posted by fangoth1
this may/may not work
pawn Код:
SetTimerEx("payday", time, true, "d", playerid);//time has to be defined
, but it should its what i use
pawn Код:
public payday(playerid) { GameTextForPlayer(playerid, "PAYDAY!!!", 10000, 3); SendClientMessage(playerid, YOUR_COLOR_HERE, "YOUR MESSAGE"); GivePlayerMoney(playerid, 5000);// or whatever you want return 1; }
|
that it is, but I use GF mode and now I dont know what to remove and what to leave behind: S