SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/11/2012, 07:30 PM   #1
rokasma
Little Clucker
 
Join Date: Jan 2012
Posts: 13
Reputation: 0
Lightbulb Age system

Hello everyone, as you can see I need help with Age system.

I will explain about system as it should be.

When you collect 1000xp you get +1 years (if you were 20 years old, and has collected 1000xp you will be 21 at the time).

Does anyone can give me an idea of ​​how to know when a player raises 1000xp on server?

How do I calculate this?

Help please

P.S. If you still don't understant what I mean, I want to make a function every time when a player rises 1000xp.
rokasma is offline   Reply With Quote
Old 09/11/2012, 08:18 PM   #2
scottyishere
Big Clucker
 
scottyishere's Avatar
 
Join Date: Oct 2009
Posts: 179
Reputation: 12
Default Re: Age system

Add a timer on OnGameModeInit, something like SetTimer("hourlytime",1000*60*60,true);
Then add the function:
pawn Code:
forward hourlytime();
public hourlytime()
{
   for(new i=0;i<MAX_PLAYERS;i++)
   {
       if(CurrentXP[i]>=1000)
       {
            CurrentAge[i]++;
            CurrentXP[i]-=1000;
       }
   }
}
__________________


Have any minor coding questions? Feel free to PM me.

http://iroleplay.site40.net -Temporary website
scottyishere is offline   Reply With Quote
Old 09/11/2012, 08:20 PM   #3
scottyishere
Big Clucker
 
scottyishere's Avatar
 
Join Date: Oct 2009
Posts: 179
Reputation: 12
Default Re: Age system

Quote:
Originally Posted by scottyishere View Post
Add a timer on OnGameModeInit, something like SetTimer("hourlytime",1000*60*60,true);
Then add the function:
pawn Code:
forward hourlytime();
public hourlytime()
{
   for(new i=0;i<MAX_PLAYERS;i++)
   {
       if(CurrentXP[i]>=1000)
       {
            CurrentAge[i]++;
            CurrentXP[i]-=1000;
       }
   }
}
Oh, now I get it. You can do a check each time the player receives the XP. Like:
pawn Code:
[player receives XP]
if(CurrentXP[playerid]>=1000)
   [stuff I did above]
__________________


Have any minor coding questions? Feel free to PM me.

http://iroleplay.site40.net -Temporary website
scottyishere is offline   Reply With Quote
Old 09/11/2012, 08:28 PM   #4
FalconWingsX
Little Clucker
 
Join Date: Sep 2012
Posts: 33
Reputation: 2
Default Re: Age system

Also, creating a timer that starts when a player connects, and on paytime, making sure it's above 40 minutes, and at paytime, reseting it, and at disconnect, reseting it. Since otherwise, the paytime would be easily abused.
FalconWingsX is offline   Reply With Quote
Old 09/11/2012, 08:32 PM   #5
rokasma
Little Clucker
 
Join Date: Jan 2012
Posts: 13
Reputation: 0
Default Re: Age system

thanks, i try it.
rokasma 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
[FilterScript] Cross Admin System V1.2 [updated] + Added IRC System + Anti Cheat(sscanf, dcmd,y_ini) No.1 Admin System CROSS_Hunter Filterscripts 21 02/01/2013 06:32 PM
[FilterScript] Cross Admin System V1.1 [updated] + Added V.I.P System(sscanf, dcmd,y_ini) No.1 Admin System CROSS_Hunter Filterscripts 8 10/09/2012 11:18 AM
[HELP] Robbery system, tax system, houseing system Commander_Shaw Help Archive 3 15/09/2010 04:18 AM


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


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