Online Time Bonus? - 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: Online Time Bonus? (
/showthread.php?tid=432145)
Online Time Bonus? -
LeeXian99 - 21.04.2013
Hey guys, I just made a timer of this.
pawn Код:
SetTimer("1hourbonus", 3600000, 1);
But, I don't know how to do it. So, basically how can I do it?
Re: Online Time Bonus? -
greentarch - 21.04.2013
A one-hour bonus for a player, so one player one timer.
pawn Код:
#include < a_samp >
new
bonusTimer[ MAX_PLAYERS ];
public OnPlayerConnect( playerid )
{
bonusTimer[ playerid ] = SetTimerEx( "BonusOneHour", 3600 * 1000 /* 3600 x 1 seconds */, true, "i", playerid );
return true;
}
public OnPlayerDisconnect( playerid, reason )
{
KillTimer( bonusTimer[ playerid ] );
return true;
}
forward BonusOneHour( playerid );
public BonusOneHour( playerid )
{
SendClientMessage( playerid, -1, "Bonus! You got a ban for playing 1 hours." );
BanEx( playerid, "Too much playing on the server." );
return true;
}
A basic one should look like that.
Re: Online Time Bonus? -
LeeXian99 - 21.04.2013
lolwat, that ban reason is obvious, anyway, I will try it out!
Re: Online Time Bonus? -
greentarch - 21.04.2013
You wanted the one without variable thingy :
pawn Код:
public OnGameModeInit( )
{
SetTimer( "OneHourBonus", 3600 * 1000, true );
return true;
}
forward OneHourBonus( );
public OneHourBonus( )
{
for ( new i, slots = GetMaxPlayers( ); i < slots; i ++ )
{
GivePlayerMoney( i, 5000 );
SendClientMessage( i, -1, "ONE HOUR AWARD!" );
}
return 1;
}