[HELP] /buycar
#1

Problem FIXED

Thanks to Shadow™
Reply
#2

Код:
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 5 to buy a vehicle!");
return 1;
Try this..

Код:
 if(PlayerInfo[playerid][pPcarkey][pLevel] < 5 || PlayerInfo[playerid][pPcarkey2][pLevel] <10 || PlayerInfo[playerid][pPcarkey3][pLevel] <20)
{
SendClientMessage(playerid, COLOR_GREY, "You do not have the requirement level to buy this vehicle!");
return 1; 
}
Reply
#3

That's not going to work... PlayerInfo has 2 settings... [playerid] and the [pInfo]... There's no third one, try this but first remove the Level 5 thing you have already:

pawn Код:
if(PlayerInfo[playerid][pPcarkey] == 999 && PlayerInfo[playerid][pLevel] >= 5) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == 999 && PlayerInfo[playerid][pLevel] >= 10) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == 999 && PlayerInfo[playerid][pLevel] >= 20) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { SendClientMessage(playerid,COLOR,"Either you own 3 vehicles or you're not the required level!"); return 1; }
Don't forget to change the COLOR on the else
Reply
#4

Or try that lol..

didn't know what way to work that..
Reply
#5

edit: o new posts im trieng now
Reply
#6

If i buy now a car it gives me 2x the same car one goes to slot 1 one to slot 2
Reply
#7

Looks like this now

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 && PlayerInfo[playerid][pLevel] >= 5) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == 999 && PlayerInfo[playerid][pLevel] >= 10) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == 999 && PlayerInfo[playerid][pLevel] >= 20) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { SendClientMessage(playerid,COLOR_GRAD1,"Either you own 3 vehicles or you're not the required level!"); 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);
SafeGivePlayerMoney(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;
}

Reply
#8

pawn Код:
if(strcmp(cmd, "/buycar", true) == 0)
{
    if(IsAnOwnableCar(idcar))
    {
        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][pLevel] >= 5) { PlayerInfo[playerid][pPcarkey] = idcar; }
            else if(PlayerInfo[playerid][pPcarkey2] == 999 && PlayerInfo[playerid][pLevel] >= 10) { PlayerInfo[playerid][pPcarkey2] = idcar; }
            else if(PlayerInfo[playerid][pPcarkey3] == 999 && PlayerInfo[playerid][pLevel] >= 20) { PlayerInfo[playerid][pPcarkey3] = idcar; }
            else { SendClientMessage(playerid,COLOR,"Either you own 3 vehicles or you're not the required level!"); return 1; }
            CarInfo[idcar][cOwned] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
            SafeGivePlayerMoney(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;
}
Reply
#9

No problemo, feel free to ask for more help if needed .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)