/buycar cmd on levels
#1

Quote:

if(strcmp(cmd, "/buycar", true) == 0)
{
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 5 to buy a vehicle!");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 999) { }
else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
else if(PlayerInfo[playerid][pPcarkey3] == 999) { }
else { SendClientMessage(playerid, COLOR_GREY, " You already own 3 vehicles"); return 1; }
if(CarInfo[idcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { return 1; }
CarInfo[idcar][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
PlayerPlayMusic(playerid);
GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /parkcar it!", 5000, 3);
SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
SendClientMessage(playerid, COLOR_GRAD2, "Type /carhelp to view the car system help");
SendClientMessage(playerid, COLOR_GRAD2, "You can start the engine up now !");
//gEngine[playerid] = 0;
//engineOn[GetPlayerVehicleID(playerid)] = false;
DateProp(playerid);
OnPropUpdate();
PlayerUpdate(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
return 1;
}

I want that example till level 10 he can buy 1 vehicle after he reaches lvl 15 he should be able to buy his 2nd vehcile etc... how to do it ?

So with lvl 10 = i can only buy 1 vehicle
With lvl 15 = im allowed to buy my 2nd vehcile etc...
Reply
#2

None can help ?

Now that lvl 5 goes for all.. if they are lvl 5 then can buy 3 cars. but i wan't example with lvl 5 they can buy 1 car lvl 10 2nd car lvl 15 3rd car etc...
Reply
#3

try this one

pawn Code:
if(strcmp(cmd, "/buycar", true) == 0)
  {
        if(IsAnOwnableCar(idcar))
        {
          if(PlayerInfo[playerid][pLevel] > 10)
        {
            SendClientMessage(playerid, COLOR_GREY, "You need to be level 10 to buy a vehicle!");
            return 1;
        }
        if(PlayerInfo[playerid][pPcarkey] == 999) { }
        else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
        else if(PlayerInfo[playerid][pPcarkey3] == 999) { }
        else { SendClientMessage(playerid, COLOR_GREY, "You already own 3 vehicles"); return 1; }
        if(CarInfo[idcar][cOwned]==1)
        {
          SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car");
          return 1;
        }
        if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
        {
          if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
          else { return 1; }
         CarInfo[idcar][cOwned] = 1;
         GetPlayerName(playerid, sendername, sizeof(sendername));
         strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
         GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
         PlayerPlayMusic(playerid);
         GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /parkcar it!", 5000, 3);
         SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
         SendClientMessage(playerid, COLOR_GRAD2, "Type /carhelp to view the car system help");
         SendClientMessage(playerid, COLOR_GRAD2, "You can start the engine up now !");
         //gEngine[playerid] = 0;
         //engineOn[GetPlayerVehicleID(playerid)] = false;
         DateProp(playerid);
         OnPropUpdate();
         PlayerUpdate(playerid);
         return 1;
        }
        else
        {
          SendClientMessage(playerid, COLOR_GREY, "You don't have enough cash with you ! ");
          return 1;
        }
        }
       return 1;
      }
_________________________________________________
all you have to do is change
pawn Code:
if(PlayerInfo[playerid][pLevel] > 5)
to
pawn Code:
if(PlayerInfo[playerid][pLevel] > 10)
Reply
#4

yo i dont mean this.. Now you can buy 3 vehicles if your level 5.. but i want if you level 5 u can only buy 1 vehicle if ur lvl 10 u can buy ur 2nd vehicle etc..
Reply
#5

these are car keys ?

pawn Code:
if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
Reply
#6

ye

999 = u dont own any car
Reply
#7

cant help you with this sorry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)