Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:buylevel(playerid,params[])
- {
- if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login 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;
- format(string,sizeof(string),"{3A8EBA}Felicitari, acum ai level %d!",PlayerInfo[playerid][pLevel]);
- SCM(playerid,COLOR_WHITE,string);
- format(string, sizeof(string), "* %s are acum 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]);
- }
- else return SendClientMessage(playerid, COLOR_WHITE,"{FFB870}You are not logged in.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement