[Help] Vehicle System.
#2

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(playeridtext[])
{
public 
LoadCars()
{
    new 
arrCoords[17][64];
    new 
strFromFile2[256];
    new 
Filefile fopen("Cars/cars2.cfg",io_read);
    if (
file)
    {
        new 
idx;
        while (
idx sizeof(Cars))
        {
            
fread(filestrFromFile2);
            
split(strFromFile2arrCoords'|');
            
strmid(Cars[idx][cDescription], arrCoords[0], 0strlen(arrCoords[0]), 255);
            
strmid(Cars[idx][cOwner], arrCoords[1], 0strlen(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(playeridreason)
{
new 
car PlayerInfo[playerid][pCarKey];
    if(
Cars[car][cLocked] == 1)
    {
        
Cars[car][ccLocked] = 1;
        
Cars[car][cLocked] = 0;
    }
SaveCars;
return 
1;

the system is more easy and it can changing ids, also in .CFG is
Код:
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|
the x1,y1,z1,angler1 is for in case if somebody bought vehicle
I hope my system will help you
Reply


Messages In This Thread
[Help] Vehicle System. - by BlackSA - 08.11.2011, 13:06
Re: [Help] Vehicle System. - by mineralo - 08.11.2011, 14:24
Re: [Help] Vehicle System. - by BlackSA - 08.11.2011, 15:11
Re: [Help] Vehicle System. - by mineralo - 08.11.2011, 16:09
Re: [Help] Vehicle System. - by BlackSA - 08.11.2011, 16:40

Forum Jump:


Users browsing this thread: 3 Guest(s)