08.11.2011, 14:24
PHP код:
enum CarSystem
{
cDescription[MAX_PLAYER_NAME],
cOwner[MAX_PLAYER_NAME],
Float:cX,
Float:cY,
Float:cZ,
Float:cTempX,
Float:cTempY,
Float:cTempZ,
Float:cAngle,
Float:cTempAngle,
cOwned,
cPrice,
cLocked,
cModel,
cCol1,
cCol2,
ownedvehicle,
ccLocked,
};
new Cars[28][CarSystem]; // 28 CARS !
forward LoadCars();
forward SaveCars();
public OnGameModeInit()
{
LoadCars;
carsavetimer = SetTimer("SaveCars",60000,1);
return 1;
}
public OnPlayerText(playerid, text[])
{
public LoadCars()
{
new arrCoords[17][64];
new strFromFile2[256];
new File: file = fopen("Cars/cars2.cfg",io_read);
if (file)
{
new idx;
while (idx < sizeof(Cars))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
strmid(Cars[idx][cDescription], arrCoords[0], 0, strlen(arrCoords[0]), 255);
strmid(Cars[idx][cOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
Cars[idx][cModel] = strval(arrCoords[2]);
Cars[idx][cX] = floatstr(arrCoords[3]);
Cars[idx][cY] = floatstr(arrCoords[4]);
Cars[idx][cZ] = floatstr(arrCoords[5]);
Cars[idx][cAngle] = floatstr(arrCoords[6]);
Cars[idx][cOwned] = strval(arrCoords[7]);
Cars[idx][cPrice] = strval(arrCoords[8]);
Cars[idx][cLocked] = strval(arrCoords[9]);
Cars[idx][cCol1] = strval(arrCoords[10]);
Cars[idx][cCol2] = strval(arrCoords[11]);
Cars[idx][cTempX] = floatstr(arrCoords[12]);
Cars[idx][cTempY] = floatstr(arrCoords[13]);
Cars[idx][cTempZ] = floatstr(arrCoords[14]);
Cars[idx][cTempAngle] = floatstr(arrCoords[15]);
Cars[idx][cTempX] = Cars[idx][cX];
Cars[idx][cTempY] = Cars[idx][cY];
Cars[idx][cTempZ] = Cars[idx][cZ];
Cars[idx][cTempAngle] = Cars[idx][cAngle];
Cars[idx][ccLocked] = strval(arrCoords[16]);
Cars[idx][ownedvehicle] = CreateVehicle(Cars[idx][cModel],Cars[idx][cX],Cars[idx][cY],Cars[idx][cZ],Cars[idx][cAngle],Cars[idx][cCol1],Cars[idx][cCol2],10000);
VehicleFuel[idx] = GasMax;
idx++;
}
fclose(file);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new car = PlayerInfo[playerid][pCarKey];
if(Cars[car][cLocked] == 1)
{
Cars[car][ccLocked] = 1;
Cars[car][cLocked] = 0;
}
SaveCars;
return 1;
}
Код:
Windsor|None|555|1517.418701|-694.222473|94.434265|90.076080|0|100|0|0|0|1517.418701|-694.222473|94.434265|90.076080|0 Name of Vehicle | veh's owner | vehicle's id |x|y|z|angle|0|price|color1|color2|x1|y1|z1|angle1|0|
I hope my system will help you