SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/12/2012, 02:32 PM   #1
diego_p11
Big Clucker
 
Join Date: Aug 2011
Posts: 70
Reputation: 5
Default Giving Score each hour

I need help on this =P i want that when a player achieves 1 hour online, he gets 1 score point
diego_p11 is offline   Reply With Quote
Old 17/12/2012, 02:37 PM   #2
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Giving Score each hour

Globally:
pawn Code:
new gOnlineTimer[ MAX_PLAYERS ];
//making a global variable to use later when killing the looping timer

OnPlayerConnect:
pawn Code:
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 Code:
KillTimer( gOnlineTimer[ playerid ] );
//killing the timer so that it won't run when the player disconnects

Anywhere:
pawn Code:
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.
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline   Reply With Quote
Old 17/12/2012, 02:49 PM   #3
diego_p11
Big Clucker
 
Join Date: Aug 2011
Posts: 70
Reputation: 5
Default Re: Giving Score each hour

but, how it will look already in pawn?
diego_p11 is offline   Reply With Quote
Old 17/12/2012, 02:51 PM   #4
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,844
Reputation: 1399
Default Re: Giving Score each hour

Quote:
Originally Posted by diego_p11 View Post
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!
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 hour playing = 1 Score kbalor Scripting Help 3 16/06/2012 11:25 AM
Need help with command! (zcmd) giving +1 score Request Scripting Help 25 23/12/2011 09:49 AM
How to make players score rise every 1 hour? Feel Scripting Help 5 29/10/2011 01:57 AM
[HOW]Hour passes and he/she gets +1 Score??? vakhtang Help Archive 1 19/03/2011 02:32 PM
[HELP]Giving +10 score points with.. LasTRace Help Archive 5 22/07/2010 12:55 PM


All times are GMT. The time now is 03:14 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.