PHP код:
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;
}
Вот загрузка машин.
Кол-во , ну может загружаться до 300 или 400 , так как онлайн максимальный 160 - 170 , и каждый игрок может имееть по 2 машины , а некоторые по 3.