Age system
#1

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.
Reply
#2

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;
       }
   }
}
Reply
#3

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]
Reply
#4

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.
Reply
#5

thanks, i try it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)