29.08.2013, 06:18
Well like the title say. I'm having a thought about why the problem is there.
I have different variabels for the vehicles you own and for those who are sales vehicles so I can save them in different files.(Don't know if that can cause the problem, it's just a thought)
Anyway, here is the code to buy.
EDIT: The vehicle is shown in your stats but when you enter it it says "Owner: Dealership" and you can't /engine it
I have different variabels for the vehicles you own and for those who are sales vehicles so I can save them in different files.(Don't know if that can cause the problem, it's just a thought)
Anyway, here is the code to buy.
pawn Код:
else if(strcmp(x_nr,"buy",true) == 0)
{
if(IsASalesVehicle(idcar))
{
if(PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 2 to buy a vehicle!");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999 || PlayerInfo[playerid][pPcarkey3] == 9999) { }
else return SendClientMessage(playerid, COLOR_GREY,"* You already own three cars!");
if(GetPlayerMoney(playerid) >= SalesCarInfo[idcar][scPrice])
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
format(string, sizeof(string),"LARP/Vehicles/%d.ini",idcar)
dini_Create(string);
if(PlayerInfo[playerid][pPcarkey] == 9999) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == 9999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == 9999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { PlayerInfo[playerid][pPcarkey] = idcar; }
CarInfo[idcar][cOwned] = 1;
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
SafeGivePlayerMoney(playerid,-SalesCarInfo[idcar][scPrice]);
PlayerPlayMusic(playerid);
SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
SendClientMessage(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!");
gEngine[playerid] = 0;
engineOn[GetPlayerVehicleID(playerid)] = false;
OnPropUpdate(4,idcar);
OnPlayerUpdateEx(playerid);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}