// type 1 - car | 2 - moto/bike | 3 - heli | 4 - premium cars.
public InsertCar(playerid,type,stockid)
{
new string[128],sendername[25],namecar[100];
new idd = Findcar();
new model = Stock[stockid][vModel];
new value = Stock[stockid][vPrice];
strmid(namecar,Stock[stockid][vName], 0, 100, 255);
GetPlayerName(playerid,sendername,sizeof(sendername));
BuyCar[playerid] = -1;
if(idd != 0)
{
if(GetPlayerCash(playerid) < value) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have enough money.");
if(type == 1)
{
if(PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 1 plus car.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
{
PlayerInfo[playerid][pPPluscarkey2] = idd;
Update(playerid,pPPluscarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 plus cars.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 0 && PlayerInfo[playerid][pPremiumAccount] > 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey] == 0)
{
PlayerInfo[playerid][pprcarkey] = idd;
Update(playerid,pprcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey2] == 0)
{
PlayerInfo[playerid][pprcarkey2] = idd;
Update(playerid,pprcarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 1 plus car.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] > 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey] == 0)
{
PlayerInfo[playerid][pprcarkey] = idd;
Update(playerid,pprcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey2] == 0)
{
PlayerInfo[playerid][pprcarkey2] = idd;
Update(playerid,pprcarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
{
PlayerInfo[playerid][pPPluscarkey2] = idd;
Update(playerid,pPPluscarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 2 plus cars.");
}
}
if(PlayerInfo[playerid][pPremiumAccount] > 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey] == 0)
{
PlayerInfo[playerid][pprcarkey] = idd;
Update(playerid,pprcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey2] == 0)
{
PlayerInfo[playerid][pprcarkey2] = idd;
Update(playerid,pprcarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 premium cars + 2 cars.");
}
}
}
Stock[stockid][vStock]--;
mysql_format(SQL, string, sizeof(string), "UPDATE stock SET Stock='%d' WHERE ID='%d'", Stock[stockid][vStock],stockid);
mysql_tquery(SQL,string,"","");
GivePlayerCash(playerid,-value);
Update(playerid,pCashx);
CarInfo[idd][cSell] = 1;
CarInfo[idd][cID] = idd;
CarInfo[idd][cModel] = model;
CarInfo[idd][cColorOne] = 1;
CarInfo[idd][cColorTwo] = 1;
strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
CarInfo[idd][cValue] = value;
strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
CarInfo[idd][cOwned] = 1;
CarInfo[idd][cLock] = 0;
CarInfo[idd][cTimed] = 0;
CarInfo[idd][cInscarprice] = 100;
CarInfo[idd][cInsurancecar] = 4;
CarInfo[idd][cKM] = 0.0;
CarInfo[idd][cHP] = 1000.0;
CarInfo[idd][cDamage1] = 0;
CarInfo[idd][cDamage2] = 0;
CarInfo[idd][cDamage3] = 0;
CarInfo[idd][cDamage4] = 0;
CarInfo[idd][cGas] = 100;
CarInfo[idd][cPaintJ] = 6;
CarInfo[idd][mod1] = 0;
CarInfo[idd][mod2] = 0;
CarInfo[idd][mod3] = 0;
CarInfo[idd][mod4] = 0;
CarInfo[idd][mod5] = 0;
CarInfo[idd][mod6] = 0;
CarInfo[idd][mod7] = 0;
CarInfo[idd][mod8] = 0;
CarInfo[idd][mod9] = 0;
CarInfo[idd][mod10] = 0;
CarInfo[idd][mod11] = 0;
CarInfo[idd][mod12] = 0;
CarInfo[idd][mod13] = 0;
CarInfo[idd][mod14] = 0;
CarInfo[idd][mod15] = 0;
CarInfo[idd][mod16] = 0;
CarInfo[idd][mod17] = 0;
CarInfo[idd][cDays] = 0;
new randomds = random(12)+1;
CarInfo[idd][cLocationx] = RandomDealership[randomds][0];
CarInfo[idd][cLocationy] = RandomDealership[randomds][1];
CarInfo[idd][cLocationz] = RandomDealership[randomds][2];
CarInfo[idd][cAngle] = RandomDealership[randomds][3];
vUpdate(idd, cModsx);
vUpdate(idd, cPaintJx);
vUpdate(idd, cSellx);
vUpdate(idd, cLocationxx);
vUpdate(idd, cLocationyx);
vUpdate(idd, cLocationzx);
vUpdate(idd, cAnglex);
vUpdate(idd, cModelx);
vUpdate(idd, cColorOnex);
vUpdate(idd, cColorTwox);
vUpdate(idd, cOwnerx);
vUpdate(idd, cValuex);
vUpdate(idd, cLicensex);
vUpdate(idd, cDescriptionx);
vUpdate(idd, cLockx);
vUpdate(idd, cTimedx);
vUpdate(idd, cInscarpricex);
vUpdate(idd, cInsurancecarx);
vUpdate(idd, cKMx);
vUpdate(idd, cOwnedx);
vUpdate(idd, cDaysx);
vUpdate(idd, cHPx);
vUpdate(idd, cDamage1x);
vUpdate(idd, cDamage2x);
vUpdate(idd, cDamage3x);
vUpdate(idd, cDamage4x);
vUpdate(idd, cGasx);
new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);
new disp[184],stringsss[256],numele[30];
format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
SCM(playerid,COLOR_LIGHTBLUE,disp);
GetPlayerName(playerid, numele, sizeof(numele));
format(stringsss,sizeof(stringsss),"%s [user:%d] bought a %s [car:%d] for $%s.",numele,PlayerInfo[playerid][pSQLID],CarInfo[idd][cDescription],CarInfo[idd][cID],FormatNumber(value));
ABroadCast(COLOR_YELLOW,stringsss,1);
new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
getdate(y,m,d);
gettime(h,mi,s);
format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s",d,m,y,h,mi,s,stringsss);
mysql_real_escape_string(string2, string3);
mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
mysql_tquery(SQL,var100,"","");
OwnedVeh(car) = idd;
if(idd == PlayerInfo[playerid][pPcarkey])
{
personalcar[0][playerid] = car;
}
if(idd == PlayerInfo[playerid][pmotokey])
{
personalcar[1][playerid] = car;
}
if(idd == PlayerInfo[playerid][pprcarkey])
{
personalcar[2][playerid] = car;
}
if(idd == PlayerInfo[playerid][pprcarkey2])
{
personalcar[3][playerid] = car;
}
if(idd == PlayerInfo[playerid][pPPluscarkey])
{
personalcar[4][playerid] = car;
}
if(idd == PlayerInfo[playerid][pPPluscarkey2])
{
personalcar[5][playerid] = car;
}
masini++;
SwitchKey[playerid] = 1;
}
if(idd == 0)
{
if(GetPlayerCash(playerid) < value) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have enough money.");
new Cache: sar = mysql_query(SQL,"SELECT * FROM `cars`");
idd = cache_num_rows()+1;
cache_delete(sar);
if(type == 1)
{
if(PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 1 plus car.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
{
PlayerInfo[playerid][pPPluscarkey2] = idd;
Update(playerid,pPPluscarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 plus cars.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 0 && PlayerInfo[playerid][pPremiumAccount] > 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey] == 0)
{
PlayerInfo[playerid][pprcarkey] = idd;
Update(playerid,pprcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey2] == 0)
{
PlayerInfo[playerid][pprcarkey2] = idd;
Update(playerid,pprcarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 1 plus car.");
}
}
if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] > 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey] == 0)
{
PlayerInfo[playerid][pprcarkey] = idd;
Update(playerid,pprcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey2] == 0)
{
PlayerInfo[playerid][pprcarkey2] = idd;
Update(playerid,pprcarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey] == 0)
{
PlayerInfo[playerid][pPPluscarkey] = idd;
Update(playerid,pPPluscarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
{
PlayerInfo[playerid][pPPluscarkey2] = idd;
Update(playerid,pPPluscarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 2 plus cars.");
}
}
if(PlayerInfo[playerid][pPremiumAccount] > 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 0)
{
PlayerInfo[playerid][pPcarkey] = idd;
Update(playerid,pPcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else
{
if(PlayerInfo[playerid][pmotokey] == 0)
{
PlayerInfo[playerid][pmotokey] = idd;
Update(playerid,pmotokeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey] == 0)
{
PlayerInfo[playerid][pprcarkey] = idd;
Update(playerid,pprcarkeyx);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else if(PlayerInfo[playerid][pprcarkey2] == 0)
{
PlayerInfo[playerid][pprcarkey2] = idd;
Update(playerid,pprcarkey2x);
CarInfo[idd][cLocationx] = 284.5032;
CarInfo[idd][cLocationy] = -1526.4036;
CarInfo[idd][cLocationz] = 24.3208;
CarInfo[idd][cAngle] = 235.1191;
}
else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 premium cars + 2 cars.");
}
}
}
Stock[stockid][vStock]--;
mysql_format(SQL, string, sizeof(string), "UPDATE stock SET Stock='%d' WHERE ID='%d'", Stock[stockid][vStock],stockid);
mysql_tquery(SQL,string,"","");
GivePlayerCash(playerid,-value);
Update(playerid,pCashx);
CarInfo[idd][cID] = idd;
CarInfo[idd][cModel] = model;
CarInfo[idd][cColorOne] = 1;
CarInfo[idd][cColorTwo] = 1;
strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
CarInfo[idd][cValue] = value;
strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
CarInfo[idd][cOwned] = 1;
CarInfo[idd][cLock] = 0;
CarInfo[idd][cTimed] = 0;
CarInfo[idd][cInscarprice] = 100;
CarInfo[idd][cInsurancecar] = 4;
CarInfo[idd][cKM] = 0.0;
CarInfo[idd][cHP] = 1000.0;
CarInfo[idd][cDamage1] = 0;
CarInfo[idd][cDamage2] = 0;
CarInfo[idd][cDamage3] = 0;
CarInfo[idd][cDamage4] = 0;
CarInfo[idd][cGas] = 100;
CarInfo[idd][cSell] = 1;
CarInfo[idd][cPaintJ] = 6;
CarInfo[idd][mod1] = 0;
CarInfo[idd][mod2] = 0;
CarInfo[idd][mod3] = 0;
CarInfo[idd][mod4] = 0;
CarInfo[idd][mod5] = 0;
CarInfo[idd][mod6] = 0;
CarInfo[idd][mod7] = 0;
CarInfo[idd][mod8] = 0;
CarInfo[idd][mod9] = 0;
CarInfo[idd][mod10] = 0;
CarInfo[idd][mod11] = 0;
CarInfo[idd][mod12] = 0;
CarInfo[idd][mod13] = 0;
CarInfo[idd][mod14] = 0;
CarInfo[idd][mod15] = 0;
CarInfo[idd][mod16] = 0;
CarInfo[idd][mod17] = 0;
CarInfo[idd][cDays] = 0;
new randomds = random(12)+1;
CarInfo[idd][cLocationx] = RandomDealership[randomds][0];
CarInfo[idd][cLocationy] = RandomDealership[randomds][1];
CarInfo[idd][cLocationz] = RandomDealership[randomds][2];
CarInfo[idd][cAngle] = RandomDealership[randomds][3];
mysql_format(SQL, string, sizeof(string),"INSERT INTO cars (ID, Model) VALUES (%d, %d)", idd, CarInfo[idd][cModel]);
mysql_tquery(SQL,string,"","");
vUpdate(idd, cModsx);
vUpdate(idd, cPaintJx);
vUpdate(idd, cSellx);
vUpdate(idd, cLocationxx);
vUpdate(idd, cLocationyx);
vUpdate(idd, cLocationzx);
vUpdate(idd, cAnglex);
vUpdate(idd, cColorOnex);
vUpdate(idd, cColorTwox);
vUpdate(idd, cOwnerx);
vUpdate(idd, cValuex);
vUpdate(idd, cLicensex);
vUpdate(idd, cDescriptionx);
vUpdate(idd, cLockx);
vUpdate(idd, cTimedx);
vUpdate(idd, cInscarpricex);
vUpdate(idd, cInsurancecarx);
vUpdate(idd, cKMx);
vUpdate(idd, cOwnedx);
vUpdate(idd, cDaysx);
vUpdate(idd, cHPx);
vUpdate(idd, cDamage1x);
vUpdate(idd, cDamage2x);
vUpdate(idd, cDamage3x);
vUpdate(idd, cDamage4x);
vUpdate(idd, cGasx);
new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);
new disp[184],stringsss[256],numele[30];
format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
SCM(playerid,COLOR_LIGHTBLUE,disp);
GetPlayerName(playerid, numele, sizeof(numele));
format(stringsss,sizeof(stringsss),"%s [user:%d] bought a %s [car:%d] for $%s.",numele,PlayerInfo[playerid][pSQLID],CarInfo[idd][cDescription],CarInfo[idd][cID],FormatNumber(value));
ABroadCast(COLOR_YELLOW,stringsss,1);
new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
getdate(y,m,d);
gettime(h,mi,s);
format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s",d,m,y,h,mi,s,stringsss);
mysql_real_escape_string(string2, string3);
mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
mysql_tquery(SQL,var100,"","");
OwnedVeh(car) = idd;
if(idd == PlayerInfo[playerid][pPcarkey])
{
personalcar[0][playerid] = car;
}
if(idd == PlayerInfo[playerid][pmotokey])
{
personalcar[1][playerid] = car;
}
if(idd == PlayerInfo[playerid][pprcarkey])
{
personalcar[2][playerid] = car;
}
if(idd == PlayerInfo[playerid][pprcarkey2])
{
personalcar[3][playerid] = car;
}
if(idd == PlayerInfo[playerid][pPPluscarkey])
{
personalcar[4][playerid] = car;
}
if(idd == PlayerInfo[playerid][pPPluscarkey2])
{
personalcar[5][playerid] = car;
}
masini++;
SwitchKey[playerid] = 1;
}
return 1;
}