Giving Score each hour
#1

I need help on this =P i want that when a player achieves 1 hour online, he gets 1 score point
Reply
#2

Globally:
pawn Код:
new gOnlineTimer[ MAX_PLAYERS ];
//making a global variable to use later when killing the looping timer
OnPlayerConnect:
pawn Код:
gOnlineTimer[ playerid ] = SetTimerEx( "HourScoreIncome", 60*60*1000, true, "i", playerid );
//here we initialize the timer, and assigns the global variable as its ID. The timer will loop every 60*60*1000th millisecond, which is every hour.
OnPlayerDisconnect:
pawn Код:
KillTimer( gOnlineTimer[ playerid ] );
//killing the timer so that it won't run when the player disconnects
Anywhere:
pawn Код:
forward HourScoreIncome(playerid);
public HourScoreIncom(playerid)
    return SetPlayerScore( playerid, GetPlayerScore( playerid ) + 1 );
//simply adding 1 to the player's current score (the timer function)
This should work.
Reply
#3

but, how it will look already in pawn?
Reply
#4

Quote:
Originally Posted by diego_p11
Посмотреть сообщение
but, how it will look already in pawn?
He gave you instructions about how you can make it and where you should add the piece of code.
Don't wait for a finished code to just paste into your script.. try to add what LarzI said to where he said!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)