I made a textdraw dealership system. Whenever i buy a vehicle it supposed to TP me into the new vehicle but instead is spawns me infront of the first business (Business ID ) in my MySQL.
Код:
if(playertextid == CarBuy[playerid][7])
{
new num = getNumOwnedCars(playerid);
if(num >= GetPVarInt(playerid, "MaxCars"))
{
SendClientMessage(playerid, X11_TOMATO_2, "You cannot own any more cars");
return 0;
}
if(GetPVarInt(playerid,"dealership_type") == 0)
{
format(tempstr,sizeof(tempstr),"Congratulations! You are now the owner of a %s",VehiclesName[EBDNormalCars[Dealership_vehicle_list[playerid]][EBCarModelID]-400]);
if(GetMoneyEx(playerid) >= EBDNormalCars[ Dealership_vehicle_list[playerid] ][EBCarPrice])
{
GiveMoneyEx(playerid, -EBDNormalCars[Dealership_vehicle_list[playerid]][EBCarPrice]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, tempstr);
new Float:X,Float:Y,Float:Z,Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
new biz = GetPVarInt(playerid, "BuyingBiz");
addToBusinessTill(biz, EBDNormalCars[Dealership_vehicle_list[playerid]][EBCarPrice]/4);
addToBusinessProducts(biz, -25);
exitBiz(playerid, i);
CreatePlayerCar(playerid, EBDNormalCars[Dealership_vehicle_list[playerid]][EBCarModelID], 0, 0, Business[biz][EBusinessExitX],Business[biz][EBusinessExitY],Business[biz][EBusinessExitZ], A, ELockType_Default,1);
}
else
{
SendClientMessage(playerid, X11_RED, "You don't have enough money");
}
}
else if(GetPVarInt(playerid,"dealership_type") == 1)
{
format(tempstr,sizeof(tempstr),"Congratulations! You are now the owner of a %s",VehiclesName[EBDFastCars[Dealership_vehicle_list[playerid]][EBCarModelID]-400]);
if(GetMoneyEx(playerid) >= EBDFastCars[ Dealership_vehicle_list[playerid] ][EBCarPrice])
{
GiveMoneyEx(playerid, -EBDFastCars[Dealership_vehicle_list[playerid]][EBCarPrice]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, tempstr);
new Float:X,Float:Y,Float:Z,Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
new biz = GetPVarInt(playerid, "BuyingBiz");
addToBusinessTill(biz, EBDFastCars[Dealership_vehicle_list[playerid]][EBCarPrice]/4);
addToBusinessProducts(biz, -25);
CreatePlayerCar(playerid, EBDFastCars[Dealership_vehicle_list[playerid]][EBCarModelID], 0, 0, Business[biz][EBusinessExitX],Business[biz][EBusinessExitY],Business[biz][EBusinessExitZ], A, ELockType_Default,1);
}
else
{
SendClientMessage(playerid, X11_RED, "You don't have enough money");
}
}
else if(GetPVarInt(playerid,"dealership_type") == 2)
{
format(tempstr,sizeof(tempstr),"Congratulations! You are now the owner of a %s",VehiclesName[EBDBikes[Dealership_vehicle_list[playerid]][EBCarModelID]-400]);
if(GetMoneyEx(playerid) >= EBDBikes[ Dealership_vehicle_list[playerid] ][EBCarPrice])
{
GiveMoneyEx(playerid, -EBDBikes[Dealership_vehicle_list[playerid]][EBCarPrice]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, tempstr);
new Float:X,Float:Y,Float:Z,Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
new biz = GetPVarInt(playerid, "BuyingBiz");
addToBusinessTill(biz, EBDBikes[Dealership_vehicle_list[playerid]][EBCarPrice]/4);
addToBusinessProducts(biz, -25);
CreatePlayerCar(playerid, EBDBikes[Dealership_vehicle_list[playerid]][EBCarModelID], 0, 0, Business[biz][EBusinessExitX],Business[biz][EBusinessExitY],Business[biz][EBusinessExitZ], A, ELockType_Default,1);
}
else
{
SendClientMessage(playerid, X11_RED, "You don't have enough money");
}
}
Well if you don't know the problem than you should ask the person who wrote this code