100 EXP = Rank up
#1

Well guys, i've been working on a Server - Biological Warfare, and i've been creating an EXP bar, but how could i do it like:

pawn Код:
public RankCheck(playerid)
{
  if(GetPlayerRank(playerid) == 1)
  {
    TextDrawSetString(Text:tRank,"Rank: Private IT");
    SetProgressBarValue(Bar:RankBar, 4);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 2)
  {
    TextDrawSetString(Text:tRank,"Rank: Private");
    SetProgressBarValue(Bar:RankBar, 8);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 3)
  {
    TextDrawSetString(Text:tRank,"Rank: Private F. Class");
    SetProgressBarValue(Bar:RankBar, 12);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 4)
  {
    TextDrawSetString(Text:tRank,"Rank: Corporal");
    SetProgressBarValue(Bar:RankBar, 16);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 5)
  {
    TextDrawSetString(Text:tRank,"Rank: Sergeant");
    SetProgressBarValue(Bar:RankBar, 20);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 6)
  {
    TextDrawSetString(Text:tRank,"Rank: Staff Sergeant");
    SetProgressBarValue(Bar:RankBar, 24);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 7)
  {
    TextDrawSetString(Text:tRank,"Rank: Master Sergeant");
    SetProgressBarValue(Bar:RankBar, 28);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 8)
  {
    TextDrawSetString(Text:tRank,"Rank: First Sergeant");
    SetProgressBarValue(Bar:RankBar, 32);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 9)
  {
    TextDrawSetString(Text:tRank,"Rank: Sergeant Major");
    SetProgressBarValue(Bar:RankBar, 36);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 10)
  {
    TextDrawSetString(Text:tRank,"Rank: Warrant Officer 1");
    SetProgressBarValue(Bar:RankBar, 40);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 11)
  {
    TextDrawSetString(Text:tRank,"Rank: Warrant Officer 2");
    SetProgressBarValue(Bar:RankBar, 44);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 12)
  {
    TextDrawSetString(Text:tRank,"Rank: Warrant Officer 3");
    SetProgressBarValue(Bar:RankBar, 48);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 13)
  {
    TextDrawSetString(Text:tRank,"Rank: Warrant Officer 4");
    SetProgressBarValue(Bar:RankBar, 52);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 14)
  {
    TextDrawSetString(Text:tRank,"Rank: Warrant Officer 5");
    SetProgressBarValue(Bar:RankBar, 56);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 15)
  {
    TextDrawSetString(Text:tRank,"Rank: Second Lieutenant");
    SetProgressBarValue(Bar:RankBar, 60);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 16)
  {
    TextDrawSetString(Text:tRank,"Rank: First Lieutenant");
    SetProgressBarValue(Bar:RankBar, 64);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 17)
  {
    TextDrawSetString(Text:tRank,"Rank: Captain");
    SetProgressBarValue(Bar:RankBar, 68);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 18)
  {
    TextDrawSetString(Text:tRank,"Rank: Major");
    SetProgressBarValue(Bar:RankBar, 72);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 19)
  {
    TextDrawSetString(Text:tRank,"Rank: Lieutenant Colonel");
    SetProgressBarValue(Bar:RankBar, 76);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 20)
  {
    TextDrawSetString(Text:tRank,"Rank: Colonel");
    SetProgressBarValue(Bar:RankBar, 80);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 21)
  {
    TextDrawSetString(Text:tRank,"Rank: Brigadier General");
    SetProgressBarValue(Bar:RankBar, 84);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 22)
  {
    TextDrawSetString(Text:tRank,"Rank: Major General");
    SetProgressBarValue(Bar:RankBar, 88);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 23)
  {
    TextDrawSetString(Text:tRank,"Rank: Lieutenant General");
    SetProgressBarValue(Bar:RankBar, 92);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 24)
  {
    TextDrawSetString(Text:tRank,"Rank: General");
    SetProgressBarValue(Bar:RankBar, 96);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    if(GetPlayerRank(playerid) == 25)
  {
    TextDrawSetString(Text:tRank,"Rank: General Of The Army");
    SetProgressBarValue(Bar:RankBar, 100);
    UpdateProgressBar(Bar:RankBar, playerid);
    return 1;
    }
    return 1;
}
so like SetProgressBarValue(BAR:RankBar, exp); then say 100 exp = rank, how could i do that? if you get what i'm trying to acomplish
Reply
#2

Those ProgressBar functions you are using do not exist, except if you're using some include or plugin and if it's so, you have to ask in the correct thread for help.
Reply
#3

... i mean how could i do add a certain % of EXP each kill like

pawn Код:
pInfo[playerid][EXP] * rInfo[EXP]
pawn Код:
enum pinfo
{
    MinutesPlayed,
    HoursPlayed,
    Kills,
    Visits,
    Rank,
    EXP,
    SaveStats,
}
new PInfo[MAX_PLAYERS][pinfo];
pawn Код:
enum rinfo
{
    RName[64],
    RRequirement,
    REXP, // this being the requirement EXP for the next rank up.
    RStartMoney,
    Float:RSpawnHealth,
    Float:RSpawnArmour,
    RSpawnWeapon,
    RSpawnAmmo,
};

new RankInfo[MAX_RANKS][rinfo];
so like

pawn Код:
OnPlayerDeath(playerid, killerid, reason)
{
  pInfo[playerid][EXP] * rInfo[EXP] / 5
  SetProgressBarValue(Bar:RankBar, EXP here);
}
Reply
#4

pawn Код:
OnPlayerDeath(playerid, killerid, reason)
{
  pInfo[playerid][EXP] += rInfo[pInfo[playerid][Rank]][REXP] / 5;
  if(pInfo[playerid][EXP] >= 100])
  {
    pInfo[playerid][EXP] -= 100;
    pInfo[playerid][Rank] ++;
   
    SendClientMessage(playerid, 0xFFFFFF, "You ranked up!");
  }
  SetProgressBarValue(Bar:RankBar, EXP here);
}
Reply
#5

100 times Current Number divided by Max Number is how you would get the percentage of the Current Number.

ex:
Код:
#define MAX_PLAYERS 500
new CurrentPlayers = 50;
new Float:Percentage = (CurrentPlayers/MAX_PLAYERS)*100;
In this case Percentage would be '10.00' or 10%
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)