Author Topic: My XP system  (Read 3276 times)

0 Members and 1 Guest are viewing this topic.

Offline MatheuS

  • Made Man
  • ***
  • Posts: 207
  • Pawn And Squirrel Scripter
    • View Profile
    • Brazillian Community
My XP system
« on: March 18, 2014, 07:30:37 pm »
Variable
Code: [Select]
new pExp[MAX_PLAYERS]; // this variable is to Experience
new pTimeUP[MAX_PLAYERS]; // this variable is the time to get XP

Function's

Code: [Select]
public OnPlayerConnect(playerid)
{
    pExp[playerid] = GetPlayerExp(playerid);// takes the value of the line "Experience" in the player file
    pTimeUP[playerid] = SetTimer("UpXP",60*60000,true);
    }
    return 1;
}

Code: [Select]
public OnPlayerDisconnect(playerid, reason)
{
   SetPlayerExp(playerid,pExp[playerid]);
}
return 1;
}

Code: [Select]
stock UpXP(playerid)
{
   
    pExp[playerid] ++;
    new string[50];
    format(string,sizeof(string),"[XP] Congratulations you just won XP on our server",pExp[playerid]);
    SendClientMessage(playerid,-1,string);
        return 1;

}

Code: [Select]
public SetPlayerExp(playerid,Exp)
{
    format(INFO,256, REGISTERS, gPlayers[playerid]); //I created this in the WarChiefs, if you use another script just change
dini_IntSet(INFO,"EXP",Exp);
}
public GetPlayerExp(playerid)
{
    format(INFO,256, REGISTERS, gPlayers[playerid]);
new exp; exp = dini_Int(INFO,"EXP");
return exp;
}

See an Error? post here

Thanks, I have helped  :o

Offline mrockxkingbutt

  • Crime Boss
  • ****
  • Posts: 373
  • I AM Best Scripter And You Are Not :P
    • View Profile
Re: My XP system
« Reply #1 on: March 18, 2014, 07:39:59 pm »
Is It Usefull? Or How Is This Usefull?
My Servers Showroom!
www.jimxvcmpscripts.createaforum.com/

Quote from:  rohanaj60
i m a great script Editor

Rofl! lmao lol

Offline MatheuS

  • Made Man
  • ***
  • Posts: 207
  • Pawn And Squirrel Scripter
    • View Profile
    • Brazillian Community
Re: My XP system
« Reply #2 on: March 18, 2014, 07:55:57 pm »
Is It Usefull? Or How Is This Usefull?

it serves to distract the players, the more time online, more xp, you can put money every level to rise