Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: MatheuS on March 18, 2014, 07:30:37 pm

Title: My XP system
Post by: MatheuS 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
Title: Re: My XP system
Post by: mrockxkingbutt on March 18, 2014, 07:39:59 pm
Is It Usefull? Or How Is This Usefull?
Title: Re: My XP system
Post by: MatheuS 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