17.08.2014, 15:43
First, you must create player variable.
new XP[MAX_PLAYERS];
Then you put XP[playerid] += amount; where you want the players gets points.
For example (This gives a killer 1 point):
public OnPlayerDeath(playerid, killerid, reason)
{
XP[killerid] += 1;
return 1;
}
Levels you can do like this:
if(XP[playerid] < 25){
SendClientMessage(playerid, -1, "You are level 1.");
}; //when he has point from 0 to 24
else if(XP[playerid] > 24 && XP[playerid] < 51){
SendClientMessage(playerid, -1, "You are level 2.");
}; //when he has points from 25 to 50
else if(XP[playerid] > 50 && XP[playerid] < 71) {
SendClientMessage(playerid, -1, "You are level 3.");
}; //when he has points from 51 to 70
new XP[MAX_PLAYERS];
Then you put XP[playerid] += amount; where you want the players gets points.
For example (This gives a killer 1 point):
public OnPlayerDeath(playerid, killerid, reason)
{
XP[killerid] += 1;
return 1;
}
Levels you can do like this:
if(XP[playerid] < 25){
SendClientMessage(playerid, -1, "You are level 1.");
}; //when he has point from 0 to 24
else if(XP[playerid] > 24 && XP[playerid] < 51){
SendClientMessage(playerid, -1, "You are level 2.");
}; //when he has points from 25 to 50
else if(XP[playerid] > 50 && XP[playerid] < 71) {
SendClientMessage(playerid, -1, "You are level 3.");
}; //when he has points from 51 to 70