Hallo,
jedes mal wenn ich unter GameModeInt bei mir im Script LoadVehicle(); einschalte dann crasht der server immer, da er irgendwie die Cars nicht aus der car.cfg herraus lesen kann.
Nun stelle ich mir die Frage warum er es nicht herraus lesen kann!
Code:public LoadVehicles()
{
new
INFO[128];
new File: CarFile = fopen("cars.cfg", io_read);
if ( CarFile )
{
new key[ 256 ], val[ 256 ];
new Data[ 256 ];
while ( fread( CarFile , Data , sizeof( Data ) ) )
{
for(new v=0;v<MAX_VEHICLES;v++)
{
key = ini_GetKey( Data );
format(INFO, sizeof(INFO), "Owner[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vOwner] = strval( val ); printf("Succesfull Loaded %s",INFO); printf("%s",strval(val)); }
//else {print("Succesfully return"); return 1; }
format(INFO, sizeof(INFO), "Model[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vModel] = strval( val );printf("Succesfull Loaded %s",INFO);printf("%d",strval(val)); }
format(INFO, sizeof(INFO), "Color1[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vColor1] = strval( val );printf("Succesfull Loaded %s",INFO);printf("%d",strval(val)); }
format(INFO, sizeof(INFO), "Color2[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vColor2] = strval( val );printf("Succesfull Loaded %s",INFO); printf("%d",strval(val)); }
format(INFO, sizeof(INFO), "Number[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vNumber] = strval( val );printf("Succesfull Loaded %s",INFO); printf("%s",strval(val)); }
format(INFO, sizeof(INFO), "Health[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vHealth] = strval( val );printf("Succesfull Loaded %s",INFO);printf("%d",strval(val)); }
format(INFO, sizeof(INFO), "X[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vX] = strval( val );printf("Succesfull Loaded %s",INFO);printf("%f",strval(val)); }
format(INFO, sizeof(INFO), "Y[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue( Data ); Vehicle[v][vY] = strval( val );printf("Succesfull Loaded %s",INFO);printf("%f",strval(val)); }
format(INFO, sizeof(INFO), "Z[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue(Data); Vehicle[v][vZ] = strval(val);printf("Succesfull Loaded %s",INFO);printf("%f",strval(val));}
format(INFO, sizeof(INFO), "A[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue(Data); Vehicle[v][vA] = strval(val);printf("Succesfull Loaded %s",INFO);printf("%f",strval(val));}
format(INFO, sizeof(INFO), "Locked[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue(Data); Vehicle[v][vLocked] = strval(val);printf("Succesfull Loaded %s",INFO);printf("%d",strval(val));}
format(INFO, sizeof(INFO), "ID[%d]",v);
if( strcmp( key , INFO, true ) == 0 ) { val = ini_GetValue(Data); Vehicle[v][vID] = strval(val);printf("Succesfull Loaded %s",INFO);printf("%d",strval(val));}
Vehicle[v][vID] = CreateVehicle(Vehicle[v][vModel],Vehicle[v][vX],Vehicle[v][vY],Vehicle[v][vZ],Vehicle[v][vA],Vehicle[v][vColor1],Vehicle[v][vColor2],9000000);
SpawnedVehicles ++;
}
}
fclose(CarFile);
}
return 1;
}
public CreateSavedVehicle(MODEL, Float:x,Float:y,Float:z,Float:rotation, color1, color2, owner[], numberplate[])
{
new inhalt[64];
new File: hFile = fopen("cars.cfg", io_append);
if (hFile)
{
format(inhalt, 64, "Owner[%d]=%s\n",SpawnedVehicles, owner); fwrite(hFile, inhalt);
format(inhalt, 64, "Model[%d]=%d\n",SpawnedVehicles, MODEL); fwrite(hFile, inhalt);
format(inhalt, 64, "X[%d]=%f\n",SpawnedVehicles, Float:x); fwrite(hFile, inhalt);
format(inhalt, 64, "Y[%d]=%f\n",SpawnedVehicles, Float:y); fwrite(hFile, inhalt);
format(inhalt, 64, "Z[%d]=%f\n",SpawnedVehicles, Float:z); fwrite(hFile, inhalt);
format(inhalt, 64, "A[%d]=%f\n",SpawnedVehicles, Float:rotation); fwrite(hFile, inhalt);
format(inhalt, 64, "Color1[%d]=%d\n",SpawnedVehicles, color1); fwrite(hFile, inhalt);
format(inhalt, 64, "Color2[%d]=%d\n",SpawnedVehicles, color2); fwrite(hFile, inhalt);
format(inhalt, 64, "Number[%d]=%s\n",SpawnedVehicles, numberplate); fwrite(hFile, inhalt);
format(inhalt, 64, "Locked[%d]=1\n",SpawnedVehicles); fwrite(hFile, inhalt);
format(inhalt, 64, "ID[%d]=%d\n", SpawnedVehicles, SpawnedVehicles); fwrite(hFile, inhalt);
CreateVehicle(MODEL, Float:x, Float:y,Float:z,Float:rotation, color1,color2, -1);
SpawnedVehicles ++;
fclose(hFile);
}
return 1;
}
GameModeInt:
LoadVehicles();
Bitte helft mir, es ist sehr wichtig
MfG: Apoolecu
EDIT: kennt sich keiner damit aus oder wie?
bitte helft mir doch ist doch eigentlich nicht so schwer oder?