Help with Paycheck Timer and GivePlayerMoney
#1

Hey All,

This is my first time with PAWN and Ive read through the Wiki couldn't find what I was looking for so I thought Id ask here.

Originally,

I had my Paycheck code only work on Player id 0. So that every 300 seconds (5 min) the player would receive $3000. I then fixed it to work for all players with the following code.
Код:
public paycheck()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GivePlayerMoney(i,3000);
SendClientMessage(i, COLOR_GREEN, "5Mins $3000 Paycheck Recieved");
//SetTimer("paycheck",0,false);
}
}
I have Paycheck as a forward and paycheck as a timer in gamemodeinit. The commented line crashes the server or gives players unlimited amounts of 3000 dollars.

I was wondering how to make this:

Work for ALL Players
Reset Timer so it happens every 5 minutes.

Thanks for your time,

Regards,

Liam
Reply
#2

pawn Код:
SetTimer("paycheck",0,false);
That above sets the timer for 0 ms (miliseconds) and does not loop it (Timer never called). That would defiantly crash the server. If you want the timer to loop (Give player $3000 ever 5 mins) Just set the timer on OnGameModeInit and change the false to true (true - repeating the timer | false - the timer will be called once) And don't use a timer in the paycheck funtion.

https://sampwiki.blast.hk/wiki/SetTimer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)