Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1.  
  2.  
  3. // Progressbar
  4. new PlayerText: LevelTD;
  5. new PlayerBar: LevelBar;
  6.  
  7. gPlayerLogged[playerid] = 1;
  8. new query[256],playeriddd,strings[128],namee[30];
  9. GetPlayerName(playerid, namee, sizeof(namee));
  10.  
  11. LevelBar = CreatePlayerProgressBar(playerid, 500.00, 129.00, 108.50, 2.50, -1526682881, 100.0);
  12. UpdateProgressBar(playerid);
  13.  
  14.  
  15.  
  16. // PAYDAY SAVE
  17. if(gPlayerLogged[playerid] != 0)
  18. {
  19. OnPlayerDateUpdateX2(playerid);
  20. Update(playerid, pPayDayx);
  21. Update(playerid, pPayCheckx);
  22. Update(playerid, pFpunishx);
  23. Update(playerid, pConnectTimex);
  24. Update(playerid, pBank);
  25. Update(playerid, pCashx);
  26. Update(playerid, pRP);
  27. Update(playerid, pJailTimex);
  28. Update(playerid, pCommandsx);
  29. Update(playerid, pAmenzix);
  30. Update(playerid, pPermisex);
  31. Update(playerid, pLevelx);
  32. Update(playerid, pOnlineTimeTodayx);
  33. DestroyPlayerProgressBar(playerid, LevelBar);
  34. }
  35.  
  36. function UpdateProgressBar(playerid) {
  37. new string[64];
  38. new expamount;
  39.  
  40. if(PlayerInfo[playerid][pLevel] == 1 || PlayerInfo[playerid][pLevel] == 2 || PlayerInfo[playerid][pLevel] == 3 || PlayerInfo[playerid][pLevel] == 4) expamount = PlayerInfo[playerid][pLevel]*2;
  41. else if(PlayerInfo[playerid][pLevel] >= 5) expamount = PlayerInfo[playerid][pLevel]*levelexp;
  42.  
  43. format(string, sizeof(string), "Level: %d (%d/%d RP)", PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pExp], expamount);
  44. PlayerTextDrawSetString(playerid, LevelTD, string);
  45. PlayerTextDrawShow(playerid, LevelTD);
  46.  
  47. SetPlayerProgressBarMaxValue(playerid, LevelBar, expamount);
  48. SetPlayerProgressBarValue(playerid, LevelBar, PlayerInfo[playerid][pExp]);
  49. ShowPlayerProgressBar(playerid, LevelBar);
  50. return 1;
  51. }
  52. CMD:buylevel(playerid,params[])
  53. {
  54. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
  55. if(IsPlayerConnected(playerid))
  56. {
  57. new nxtlevel = PlayerInfo[playerid][pLevel];
  58. new costlevel;
  59. new expamount,string[128],sendername[30];
  60. if(PlayerInfo[playerid][pLevel] == 1 || PlayerInfo[playerid][pLevel] == 2 || PlayerInfo[playerid][pLevel] == 3 || PlayerInfo[playerid][pLevel] == 4)
  61. {
  62. expamount = nxtlevel*2;
  63. costlevel = nxtlevel*4000;
  64. }
  65. else if(PlayerInfo[playerid][pLevel] >= 5)
  66. {
  67. expamount = nxtlevel*levelexp;
  68. costlevel = nxtlevel*levelcost;
  69. }
  70. if (gPlayerLogged[playerid] != 0)
  71. {
  72. GetPlayerName(playerid,sendername,sizeof(sendername));
  73. if(GetPlayerCash(playerid) < costlevel) return SCM(playerid,COLOR_GRAD1,"You do not have enough cash.");
  74. if(PlayerInfo[playerid][pExp] < expamount) return SCM(playerid,COLOR_GRAD1,"You do not have the necessary number of respect points.");
  75. GivePlayerCash(playerid, -costlevel);
  76. PlayerInfo[playerid][pLevel]++;
  77. PlayerInfo[playerid][pExp] -= expamount;
  78. if(PlayerInfo[playerid][pLanguage] == 2) format(string,sizeof(string),"Felicitari, acum ai level %d!",PlayerInfo[playerid][pLevel]);
  79. else format(string,sizeof(string),"Congratulations, you are now level %d!",PlayerInfo[playerid][pLevel]);
  80. SCM(playerid, 0x3A8EBAFF, string);
  81. if(PlayerInfo[playerid][pLanguage] == 2) format(string, sizeof(string), "* %s are acum level %d.",sendername,PlayerInfo[playerid][pLevel]);
  82. else format(string, sizeof(string), "* %s is now level %d.",sendername,PlayerInfo[playerid][pLevel]);
  83. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  84. new total = PlayerInfo[playerid][pExp];
  85. if(total > 0)
  86. {
  87. PlayerInfo[playerid][pExp] = total;
  88. }
  89. else
  90. {
  91. PlayerInfo[playerid][pExp] = 0;
  92. }
  93. Update(playerid,pCashx);
  94. Update(playerid,pRP);
  95. Update(playerid,pLevelx);
  96. SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
  97. UpdateProgressBar(playerid);
  98. }
  99. else return SendClientMessage(playerid, COLOR_WHITE,"You are not logged in.");
  100. }
  101. return 1;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement