if(PI[playerid][cCarId][0] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][0]]);
DestroyVehicle(PI[playerid][cCarId][0]);
PI[playerid][cCarId][0] = INVALID_VEHICLE_ID;
}
if(PI[playerid][cCarId][1] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][1]]);
DestroyVehicle(PI[playerid][cCarId][1]);
PI[playerid][cCarId][1] = INVALID_VEHICLE_ID;
}
if(PI[playerid][cCarId][2] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][2]]);
DestroyVehicle(PI[playerid][cCarId][2]);
PI[playerid][cCarId][2] = INVALID_VEHICLE_ID;
}
stock LoadMyCar(playerid)
{
new count_car[MAX_PLAYERS] = 0;
for(new i; i < 3; i++)
{
if(PI[playerid][cModel][i] > 0 && PI[playerid][cX][i] == 0 && PI[playerid][cY][i] == 0 && PI[playerid][cZ][i] == 0) count_car[playerid]++;
}
if(count_car[playerid] > 0)
{
SendClientMessage(playerid, COLOR_ORANGE, "Один из Ваших автомобилей не был припаркован после выхода с сервера, и поэтому он был заспавнен на парковке у Анашана");
SendClientMessage(playerid, COLOR_ORANGE, "Найдите его на карте с помощью (/findcar) и припаркуйте (/park)");
}
if(PI[playerid][cModel][0] > 0)
{
if(PI[playerid][cCarId][0] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][0]]);
DestroyVehicle(PI[playerid][cCarId][0]);
PI[playerid][cCarId][0] = INVALID_VEHICLE_ID;
}
if(PI[playerid][cX][0] == 0 && PI[playerid][cY][0] == 0 && PI[playerid][cZ][0] == 0)
{
new r = random(sizeof(SalonRandSpawn));
PI[playerid][cCarId][0] = CreateVehicle(PI[playerid][cModel][0], SalonRandSpawn[r][0], SalonRandSpawn[r][1], SalonRandSpawn[r][2], SalonRandSpawn[r][3], PI[playerid][cColor1][0], PI[playerid][cColor1][1], 90000);
TuneCar(playerid);
}
else
{
PI[playerid][cCarId][0] = CreateVehicle(PI[playerid][cModel][0], PI[playerid][cX][0], PI[playerid][cY][0], PI[playerid][cZ][0], PI[playerid][cFa][0], PI[playerid][cColor1][0], PI[playerid][cColor1][1], 90000);
TuneCar(playerid);
}
PI[playerid][cLock][0] = 1;
CarDoors(PI[playerid][cCarId][0], PI[playerid][cLock][0]);
Fuel[PI[playerid][cCarId][0]] = PI[playerid][cFuel][0];
SetVehicleHealth(PI[playerid][cCarId][0], 1000);
Engine[PI[playerid][cCarId][0]] = false;
Lights[PI[playerid][cCarId][0]] = false;
switch(PI[playerid][cLock][0])
{
case 0: IsLocked[PI[playerid][cCarId][0]] = false;
case 1: IsLocked[PI[playerid][cCarId][0]] = true;
}
if(strcmp(PI[playerid][cNumber1],"Транзит",true,64) != 0)
{
format(totalstring,220,"%s",PI[playerid][cNumber1]);
VehicleLabel[PI[playerid][cCarId][0]] = CreateDynamic3DTextLabel(totalstring, 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, PI[playerid][cCarId][0], 1);
//Attach3DTextLabelToVehicle(VehicleLabel[PI[playerid][cCarId]], PI[playerid][cCarId], 0, 0, 0.1);
}
else
{
VehicleLabel[PI[playerid][cCarId][0]] = CreateDynamic3DTextLabel("Транзит", 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, PI[playerid][cCarId][0], 1);
//Attach3DTextLabelToVehicle(VehicleLabel[PI[playerid][cCarId]], PI[playerid][cCarId], 0, 0, 0.1);
}
}
if(PI[playerid][cModel][1] > 0)
{
if(PI[playerid][cCarId][1] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][1]]);
DestroyVehicle(PI[playerid][cCarId][1]);
PI[playerid][cCarId][1] = INVALID_VEHICLE_ID;
}
if(PI[playerid][cX][1] == 0 && PI[playerid][cY][1] == 0 && PI[playerid][cZ][1] == 0)
{
new r = random(sizeof(SalonRandSpawn));
PI[playerid][cCarId][1] = CreateVehicle(PI[playerid][cModel][1], SalonRandSpawn[r][0], SalonRandSpawn[r][1], SalonRandSpawn[r][2], SalonRandSpawn[r][3], PI[playerid][cColor2][0], PI[playerid][cColor2][1], 90000);
}
else
{
PI[playerid][cCarId][1] = CreateVehicle(PI[playerid][cModel][1], PI[playerid][cX][1], PI[playerid][cY][1], PI[playerid][cZ][1], PI[playerid][cFa][1], PI[playerid][cColor2][0], PI[playerid][cColor2][1], 90000);
}
PI[playerid][cLock][1] = 1;
CarDoors(PI[playerid][cCarId][1], PI[playerid][cLock][1]);
Fuel[PI[playerid][cCarId][1]] = PI[playerid][cFuel][1];
SetVehicleHealth(PI[playerid][cCarId][1], 1000);
Engine[PI[playerid][cCarId][1]] = false;
Lights[PI[playerid][cCarId][1]] = false;
switch(PI[playerid][cLock][1])
{
case 0: IsLocked[PI[playerid][cCarId][1]] = false;
case 1: IsLocked[PI[playerid][cCarId][1]] = true;
}
if(strcmp(PI[playerid][cNumber2],"Транзит",true,64) != 0)
{
format(totalstring,220,"%s",PI[playerid][cNumber2]);
VehicleLabel[PI[playerid][cCarId][1]] = CreateDynamic3DTextLabel(totalstring, 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, PI[playerid][cCarId][1], 1);
//Attach3DTextLabelToVehicle(VehicleLabel[PI[playerid][cCarId]], PI[playerid][cCarId], 0, 0, 0.1);
}
else
{
VehicleLabel[PI[playerid][cCarId][1]] = CreateDynamic3DTextLabel("Транзит", 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, PI[playerid][cCarId][1], 1);
//Attach3DTextLabelToVehicle(VehicleLabel[PI[playerid][cCarId]], PI[playerid][cCarId], 0, 0, 0.1);
}
}
if(PI[playerid][cModel][2] > 0)
{
if(PI[playerid][cCarId][2] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][2]]);
DestroyVehicle(PI[playerid][cCarId][2]);
PI[playerid][cCarId][2] = INVALID_VEHICLE_ID;
}
if(PI[playerid][cX][2] == 0 && PI[playerid][cY][2] == 0 && PI[playerid][cZ][2] == 0)
{
new r = random(sizeof(SalonRandSpawn));
PI[playerid][cCarId][2] = CreateVehicle(PI[playerid][cModel][2], SalonRandSpawn[r][0], SalonRandSpawn[r][1], SalonRandSpawn[r][2], SalonRandSpawn[r][3], PI[playerid][cColor3][0], PI[playerid][cColor3][1], 90000);
TuneCar(playerid);
}
else
{
PI[playerid][cCarId][2] = CreateVehicle(PI[playerid][cModel][2], PI[playerid][cX][2], PI[playerid][cY][2], PI[playerid][cZ][2], PI[playerid][cFa][2], PI[playerid][cColor3][0], PI[playerid][cColor3][1], 90000);
TuneCar(playerid);
}
PI[playerid][cLock][2] = 1;
CarDoors(PI[playerid][cCarId][2], PI[playerid][cLock][2]);
Fuel[PI[playerid][cCarId][2]] = PI[playerid][cFuel][2];
SetVehicleHealth(PI[playerid][cCarId][2], 1000);
Engine[PI[playerid][cCarId][2]] = false;
Lights[PI[playerid][cCarId][2]] = false;
switch(PI[playerid][cLock][2])
{
case 0: IsLocked[PI[playerid][cCarId][2]] = false;
case 1: IsLocked[PI[playerid][cCarId][2]] = true;
}
if(strcmp(PI[playerid][cNumber3],"Транзит",true,64) != 0)
{
format(totalstring,220,"%s",PI[playerid][cNumber3]);
VehicleLabel[PI[playerid][cCarId][2]] = CreateDynamic3DTextLabel(totalstring, 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, PI[playerid][cCarId][2], 1);
//Attach3DTextLabelToVehicle(VehicleLabel[PI[playerid][cCarId]], PI[playerid][cCarId], 0, 0, 0.1);
}
else
{
VehicleLabel[PI[playerid][cCarId][2]] = CreateDynamic3DTextLabel("Транзит", 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, PI[playerid][cCarId][2], 1);
//Attach3DTextLabelToVehicle(VehicleLabel[PI[playerid][cCarId]], PI[playerid][cCarId], 0, 0, 0.1);
}
}
return true;
}
if(PI[playerid][cCarId][0] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][0]]);
DestroyVehicle(PI[playerid][cCarId][0]);
PI[playerid][cCarId][0] = INVALID_VEHICLE_ID;
}
if(PlayerLogged[playerid] == true)
{
for(new i = 0; i < 3; i++)
{
if(PI[playerid][cCarId][i] != INVALID_VEHICLE_ID)
{
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][i]]);
VehicleLabel[PI[playerid][cCarId][i]] = Text3D:INVALID_3DTEXT_ID;
DestroyDynamic3DTextLabel(VehicleLabel[PI[playerid][cCarId][i]]);
PI[playerid][cCarId][i] = INVALID_VEHICLE_ID;
}
}
}
#define MAX_PLAYER_PRIVATE_VEHICLES (3)
if(PlayerLogged[playerid] == true) {
new vehicleid;
for(new i = 0; i < MAX_PLAYER_PRIVATE_VEHICLES; ++i) {
vehicleid = PI[playerid][cCarId][i];
if(vehicleid != INVALID_VEHICLE_ID) {
if(VehicleLabel[vehicleid] != INVALID_3DTEXT_ID) { // мы тут не в идеальном мире живём вообще-то
DestroyDynamic3DTextLabel(VehicleLabel[vehicleid]);
VehicleLabel[vehicleid] = Text3D:INVALID_3DTEXT_ID;
}
DestroyVehicle(vehicleid);
PI[playerid][cCarId][i] = INVALID_VEHICLE_ID;
}
}
}
stock LoadMyCar(playerid) {
new count_car = 0; //new count_car[MAX_PLAYERS] = 0; // вот это кек
for(new i = 0; i < MAX_PLAYER_PRIVATE_VEHICLES; ++i) {
if(PI[playerid][cModel][i] > 0 && PI[playerid][cX][i] == 0.0 && PI[playerid][cY][i] == 0.0 && PI[playerid][cZ][i] == 0.0) {
++count_car;
}
}
if(count_car > 0) {
SendClientMessage(playerid, COLOR_ORANGE, !"Один из Ваших автомобилей не был припаркован после выхода с сервера, и поэтому он был заспавнен на парковке у Анашана");
SendClientMessage(playerid, COLOR_ORANGE, !"Найдите его на карте с помощью (/findcar) и припаркуйте (/park)");
}
new vehicleid, modelid;
new enumid_NumberPlate[MAX_PLAYER_PRIVATE_VEHICLES] = {cNumber1, cNumber2, cNumber3};
new enumid_Color[MAX_PLAYER_PRIVATE_VEHICLES] = {cColor1, cColor2, cColor3};
for(new homecarslot = 0; homecarslot < MAX_PLAYER_PRIVATE_VEHICLES; ++homecarslot) {
vehicleid = PI[playerid][cCarId][homecarslot];
modelid = PI[playerid][cModel][homecarslot];
if(PI[playerid][cModel][homecarslot] > 0) {
if(vehicleid != INVALID_VEHICLE_ID) {
if(VehicleLabel[vehicleid] != INVALID_3DTEXT_ID) {
DestroyDynamic3DTextLabel(VehicleLabel[vehicleid]);
VehicleLabel[vehicleid] = INVALID_3DTEXT_ID;
}
}
DestroyVehicle(vehicleid);
PI[playerid][cCarId][homecarslot] = INVALID_VEHICLE_ID;
}
new Float:carPosX = PI[playerid][cX][homecarslot],
Float:carPosY = PI[playerid][cY][homecarslot],
Float:carPosZ = PI[playerid][cZ][homecarslot],
Float:carAngle= PI[playerid][cFa][homecarslot],
colorid1 = PI[playerid][enumid_Color[homecarslot]][0],
colorid2 = PI[playerid][enumid_Color[homecarslot]][1]
;
if(carPosX == 0.0 && carPosY == 0.0 && carPosZ == 0.0) {
new r = random(sizeof(SalonRandSpawn));
carPosX = SalonRandSpawn[r][0];
carPosY = SalonRandSpawn[r][1];
carPosZ = SalonRandSpawn[r][2];
carAngle= SalonRandSpawn[r][3];
}
vehicleid = CreateVehicle(modelid, carPosX, carPosY, carPosZ, carAngle, colorid1, colorid2, 90000);
PI[playerid][cCarId][homecarslot] = vehicleid;
if(vehicleid != INVALID_VEHICLE_ID) { // мир не идеален, надо проверять
TuneCar(playerid);
PI[playerid][cLock][homecarslot] = 1;
CarDoors(PI[playerid][cCarId][homecarslot], PI[playerid][cLock][homecarslot]);
Fuel[vehicleid] = PI[playerid][cFuel][homecarslot];
SetVehicleHealth(vehicleid, 1000);
Engine[vehicleid] = false;
Lights[vehicleid] = false;
IsLocked[vehicleid] = PI[playerid][cLock][homecarslot] & 1;
if(strcmp(PI[playerid][enumid_NumberPlate[homecarslot]], "Транзит", true, 64) != 0) {
format(totalstring, sizeof(totalstring), "%s", PI[playerid][enumid_NumberPlate[homecarslot]]);
VehicleLabel[vehicleid] = CreateDynamic3DTextLabel(totalstring, 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, vehicleid, 1);
//Attach3DTextLabelToVehicle(VehicleLabel[vehicleid], vehicleid, 0, 0, 0.1);
} else {
VehicleLabel[vehicleid] = CreateDynamic3DTextLabel("Транзит", 0xFFFFFFFF, 0, 0, 0, 40.0,INVALID_PLAYER_ID, vehicleid, 1);
//Attach3DTextLabelToVehicle(VehicleLabel[vehicleid], vehicleid, 0, 0, 0.1);
}
}
}
return true;
}
new count_car[MAX_PLAYERS] = 0;
// когда используется в функции только count_car[playerid]
new Float:carPosX = PI[playerid][cX][homecarslot], Float:carPosY = PI[playerid][cY][homecarslot], Float:carPosZ = PI[playerid][cZ][homecarslot], Float:carAngle= PI[playerid][cFa][homecarslot], colorid1 = PI[playerid][enumid_Color[homecarslot]][0], colorid2 = PI[playerid][enumid_Color[homecarslot]][1], //<---------тут ; if(carPosX == 0.0 && carPosY == 0.0 && carPosZ == 0.0) { new r = random(sizeof(SalonRandSpawn)); carPosX = SalonRandSpawn[r][0]; carPosY = SalonRandSpawn[r][1]; carPosZ = SalonRandSpawn[r][2]; carAngle= SalonRandSpawn[r][3]; } |