Advertisement
Guest User

Untitled

a guest
Sep 18th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. CMD:buylevel(playerid,params[])
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
  4. if(IsPlayerConnected(playerid))
  5. {
  6. new nxtlevel = PlayerInfo[playerid][pLevel];
  7. new costlevel;
  8. new expamount,string[128],sendername[30];
  9. if(PlayerInfo[playerid][pLevel] == 1 || PlayerInfo[playerid][pLevel] == 2 || PlayerInfo[playerid][pLevel] == 3 || PlayerInfo[playerid][pLevel] == 4)
  10. {
  11. expamount = nxtlevel*2;
  12. costlevel = nxtlevel*4000;
  13. }
  14. else if(PlayerInfo[playerid][pLevel] >= 5)
  15. {
  16. expamount = nxtlevel*levelexp;
  17. costlevel = nxtlevel*levelcost;
  18. }
  19. if (gPlayerLogged[playerid] != 0)
  20. {
  21. GetPlayerName(playerid,sendername,sizeof(sendername));
  22. if(GetPlayerCash(playerid) < costlevel) return SCM(playerid,COLOR_GRAD1,"You do not have enough cash.");
  23. if(PlayerInfo[playerid][pExp] < expamount) return SCM(playerid,COLOR_GRAD1,"You do not have the necessary number of respect points.");
  24. GivePlayerCash(playerid, -costlevel);
  25. PlayerInfo[playerid][pLevel]++;
  26. PlayerInfo[playerid][pExp] -= expamount;
  27. format(string,sizeof(string),"{3A8EBA}Felicitari, acum ai level %d!",PlayerInfo[playerid][pLevel]);
  28. SCM(playerid,COLOR_WHITE,string);
  29. format(string, sizeof(string), "* %s are acum level %d.",sendername,PlayerInfo[playerid][pLevel]);
  30. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  31. new total = PlayerInfo[playerid][pExp];
  32. if(total > 0)
  33. {
  34. PlayerInfo[playerid][pExp] = total;
  35. }
  36. else
  37. {
  38. PlayerInfo[playerid][pExp] = 0;
  39. }
  40. Update(playerid,pCashx);
  41. Update(playerid,pRP);
  42. Update(playerid,pLevelx);
  43. SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
  44. }
  45. else return SendClientMessage(playerid, COLOR_WHITE,"{FFB870}You are not logged in.");
  46. }
  47. return 1;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement