24.11.2012, 20:07
(
Последний раз редактировалось tony_fitto; 24.11.2012 в 20:40.
)
Hey everyone,
I'm trying to count the rows here in my dealership, so you cant by more then 5 cars.
Thats what I've come up with but some how it's not working, I don't get a warning code, I dont get anything in game. When I removed the MySQL Query above when it's checking they keys I can by a car, but some how it doesn't spawn, it doesn't add it in to the database.
I'm so tired of this so it's unbelievable, and do I get any help here? No, I never do.
I'm getting so sick so if it's so hard to help me I'm even offering payment for this.
Unbelievable....
I'm trying to count the rows here in my dealership, so you cant by more then 5 cars.
pawn Код:
new car;
if(PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 2 to buy a vehicle!");
return 1;
}
new sendername[MAX_PLAYER_NAME];
new DealershipString[900];
new Query3[9999], JaName[MAX_PLAYER_NAME], EscapedName[MAX_PLAYER_NAME];
GetPlayerName(playerid, JaName, sizeof(JaName));
new randMSG = random(sizeof(LicensePlate));
mysql_real_escape_string(JaName, EscapedName);
format(Query3, sizeof(Query3), "SELECT * FROM `vehicles` WHERE cOwner='%s'", EscapedName);
mysql_query(Query3);
mysql_store_result();
new OwnedCars = mysql_num_rows();
if(PlayerInfo[playerid][pDonateRank] != 5) {
if(OwnedCars == 0 || OwnedCars == 1 || OwnedCars == 2 || OwnedCars == 3 || OwnedCars == 4) { }
else return SendClientMessage(playerid, COLOR_GREY,"* You cant own more cars!");
} else {
if(OwnedCars == 0 || OwnedCars == 1 || OwnedCars == 2) { }
else return SendClientMessage(playerid, COLOR_GREY,"* You cant own more cars!");
}
mysql_free_result();
if(GetPlayerMoney(playerid) >= GetVehiclePrice(DealershipCar[playerid]))
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
for(new h = MAX_OWNEDCARS; h < sizeof(CarInfo); h++)
{
if(CarInfo[h][cOwned] == 1)
{
car = h + 1;
}
}
CarInfo[car][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999);
new rand = 1 + random(2);
if(rand == 1) { CarInfo[car][cLocationx] = 942.7580; CarInfo[car][cLocationy] = -1439.3134; CarInfo[car][cLocationz] = 13.6766; CarInfo[car][cAngle] = 90.0000; }
else if(rand == 2) { CarInfo[car][cLocationx] = 942.7580; CarInfo[car][cLocationy] = -1426.3774; CarInfo[car][cLocationz] = 13.6766; CarInfo[car][cAngle] = 90.0000; }
else { CarInfo[car][cLocationx] = 942.7580; CarInfo[car][cLocationy] = -1426.3774; CarInfo[car][cLocationz] = 13.6766; CarInfo[car][cAngle] = 90.0000; }
SendClientMessage(playerid, COLOR_WHITE, "[INFO]: Your new vehicle spawned behind this dealership.");
GivePlayerMoney(playerid,-GetVehiclePrice(DealershipCar[playerid]));
CarInfo[car][cModel] = GetVehicleModel(DealershipCar[playerid]);
CarInfo[car][cVirWorld] = 0;
DestroyVehicle(car);
CreateVehicle(CarInfo[car][cModel],CarInfo[car][cLocationx],CarInfo[car][cLocationy],CarInfo[car][cLocationz],CarInfo[car][cAngle],1,1,30000);
PlayerPlayMusic(playerid);
format(DealershipString, sizeof(DealershipString), "Congratulations, you just bought a %s!", ArIsim[GetVehicleModel(DealershipCar[playerid])-400]);
SendClientMessage(playerid, COLOR_GRAD2, DealershipString);
DateProp(playerid);
OnPropUpdate();
OnPlayerUpdateEx(playerid);
DestroyVehicle(DealershipCar[playerid]);
PlayerTextDrawHide(playerid, Dealership0[playerid]);
PlayerTextDrawHide(playerid, Dealership1[playerid]);
PlayerTextDrawHide(playerid, Dealership2[playerid]);
PlayerTextDrawHide(playerid, Dealership4[playerid]);
PlayerTextDrawHide(playerid, Dealership5[playerid]);
PlayerTextDrawHide(playerid, Dealership6[playerid]);
PlayerTextDrawHide(playerid, Dealership7[playerid]);
CancelSelectTextDraw(playerid);
SetCameraBehindPlayer(playerid);
DealershipID[playerid] = 0;
format(Query3, sizeof(Query3), "INSERT INTO `vehicles` (cID, cLocationx, cLocationy, cLocationz, cAngle, cColorOne, cColorTwo, cOwner, cOwned, cLicense) VALUES('%d', '%f', '%f', '%f', '%f', '1', '1', '%s', '1', '%s%d')",
car,
CarInfo[car][cModel],
CarInfo[car][cLocationx],
CarInfo[car][cLocationy],
CarInfo[car][cLocationz],
CarInfo[car][cAngle],
EscapedName,
LicensePlate[randMSG],
car);
mysql_query(Query3);
}
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;
}
I'm so tired of this so it's unbelievable, and do I get any help here? No, I never do.
I'm getting so sick so if it's so hard to help me I'm even offering payment for this.
Unbelievable....