[HELP] buycar
#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;
}

Now that lvl 5 goes for all cars that i need lvl 5

Quote:

if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 5 to buy a vehicle!");
return 1;
}

I want to edit it like this:

If your level 5 [pLevel] u can buy your 1st car [pPcarkey] || so if your level 1 you can only buy 1 vehcile
If your level 6 [pLevel] u can buy your 2nd car [pPcarkey2] || if lvl 6 2nd vehcile...
If your level 7 [pLevel] u can buy your 3th car [pPcarkey3] || if lvl 7 ur 3th vehcile
Reply
#2

do somehing like this
EXAMPLE
pawn Код:
if(PlayerInfo[playerid][pLevel] < 5) Return ............
Reply
#3

hmm tried some things none worked
Reply
#4

use =<.

means:
if level is same value or greater then continue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)