Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Progressbar
- new PlayerText: LevelTD;
- new PlayerBar: LevelBar;
- gPlayerLogged[playerid] = 1;
- new query[256],playeriddd,strings[128],namee[30];
- GetPlayerName(playerid, namee, sizeof(namee));
- LevelBar = CreatePlayerProgressBar(playerid, 500.00, 129.00, 108.50, 2.50, -1526682881, 100.0);
- UpdateProgressBar(playerid);
- // PAYDAY SAVE
- if(gPlayerLogged[playerid] != 0)
- {
- OnPlayerDateUpdateX2(playerid);
- Update(playerid, pPayDayx);
- Update(playerid, pPayCheckx);
- Update(playerid, pFpunishx);
- Update(playerid, pConnectTimex);
- Update(playerid, pBank);
- Update(playerid, pCashx);
- Update(playerid, pRP);
- Update(playerid, pJailTimex);
- Update(playerid, pCommandsx);
- Update(playerid, pAmenzix);
- Update(playerid, pPermisex);
- Update(playerid, pLevelx);
- Update(playerid, pOnlineTimeTodayx);
- DestroyPlayerProgressBar(playerid, LevelBar);
- }
- function UpdateProgressBar(playerid) {
- new string[64];
- new expamount;
- if(PlayerInfo[playerid][pLevel] == 1 || PlayerInfo[playerid][pLevel] == 2 || PlayerInfo[playerid][pLevel] == 3 || PlayerInfo[playerid][pLevel] == 4) expamount = PlayerInfo[playerid][pLevel]*2;
- else if(PlayerInfo[playerid][pLevel] >= 5) expamount = PlayerInfo[playerid][pLevel]*levelexp;
- format(string, sizeof(string), "Level: %d (%d/%d RP)", PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pExp], expamount);
- PlayerTextDrawSetString(playerid, LevelTD, string);
- PlayerTextDrawShow(playerid, LevelTD);
- SetPlayerProgressBarMaxValue(playerid, LevelBar, expamount);
- SetPlayerProgressBarValue(playerid, LevelBar, PlayerInfo[playerid][pExp]);
- ShowPlayerProgressBar(playerid, LevelBar);
- return 1;
- }
- CMD:buylevel(playerid,params[])
- {
- if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
- if(IsPlayerConnected(playerid))
- {
- new nxtlevel = PlayerInfo[playerid][pLevel];
- new costlevel;
- new expamount,string[128],sendername[30];
- if(PlayerInfo[playerid][pLevel] == 1 || PlayerInfo[playerid][pLevel] == 2 || PlayerInfo[playerid][pLevel] == 3 || PlayerInfo[playerid][pLevel] == 4)
- {
- expamount = nxtlevel*2;
- costlevel = nxtlevel*4000;
- }
- else if(PlayerInfo[playerid][pLevel] >= 5)
- {
- expamount = nxtlevel*levelexp;
- costlevel = nxtlevel*levelcost;
- }
- if (gPlayerLogged[playerid] != 0)
- {
- GetPlayerName(playerid,sendername,sizeof(sendername));
- if(GetPlayerCash(playerid) < costlevel) return SCM(playerid,COLOR_GRAD1,"You do not have enough cash.");
- if(PlayerInfo[playerid][pExp] < expamount) return SCM(playerid,COLOR_GRAD1,"You do not have the necessary number of respect points.");
- GivePlayerCash(playerid, -costlevel);
- PlayerInfo[playerid][pLevel]++;
- PlayerInfo[playerid][pExp] -= expamount;
- if(PlayerInfo[playerid][pLanguage] == 2) format(string,sizeof(string),"Felicitari, acum ai level %d!",PlayerInfo[playerid][pLevel]);
- else format(string,sizeof(string),"Congratulations, you are now level %d!",PlayerInfo[playerid][pLevel]);
- SCM(playerid, 0x3A8EBAFF, string);
- if(PlayerInfo[playerid][pLanguage] == 2) format(string, sizeof(string), "* %s are acum level %d.",sendername,PlayerInfo[playerid][pLevel]);
- else format(string, sizeof(string), "* %s is now level %d.",sendername,PlayerInfo[playerid][pLevel]);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- new total = PlayerInfo[playerid][pExp];
- if(total > 0)
- {
- PlayerInfo[playerid][pExp] = total;
- }
- else
- {
- PlayerInfo[playerid][pExp] = 0;
- }
- Update(playerid,pCashx);
- Update(playerid,pRP);
- Update(playerid,pLevelx);
- SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
- UpdateProgressBar(playerid);
- }
- else return SendClientMessage(playerid, COLOR_WHITE,"You are not logged in.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement