CreateDealership Annoying Bug
#1

Alright, after I created a dealership in-game and restart my server. All CFGs and files inside scriptfiles don't work. It's like has been wiped out.

COMMAND
Код:
CMD:createdealership(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] < 5)
	{
        SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
        return 1;
    }

    new string[128], price, radius, message[64];
    if(sscanf(params, "dds[64]", price, radius, message)) return Syntax(playerid,"createdealership", "[price] [radius] [message]");

    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    new dealershipid = CreateCarDealership(X, Y, Z, radius, price, message);
    if(dealershipid == -1)
	{
        SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Car Dealerships limit reached.");
    }
    else
	{
        format(string, sizeof(string), " SYSTEM: Car dealership created (ID %d)", dealershipid);
        SendClientMessageEx(playerid, COLOR_GRAD1, string);
    }
    return 1;
}
SAVING AND LOADING
Код:
LoadcDealerships()
{
    new string2[64];
	format(string2, sizeof(string2), "cardealerships.ini");
	new File: DealerFile = fopen(string2, io_read);
	if ( DealerFile )
	{
		new key[ 256 ] , val[ 256 ];
		new Data[ 256 ];
		while ( fread( DealerFile , Data , sizeof( Data ) ) )
		{
		    new string[128];
		    for(new f = 0; f < MAX_FAMILY; f++)
    		{
				key = ini_GetKey( Data );
				format(string, 128, "cd%dOwned",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdOwned] = strval( val ); }
				format(string, 128, "cd%dOwner",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); strmid(CarDealershipInfo[f][cdOwner], val, 0, strlen(val)-1, 255); }
				format(string, 128, "cd%dEntranceX",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdEntranceX] = floatstr( val ); }
				format(string, 128, "cd%dEntranceY",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdEntranceY] = floatstr( val ); }
				format(string, 128, "cd%dEntranceZ",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdEntranceZ] = floatstr( val ); }
				format(string, 128, "cd%dExitX",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdExitX] = floatstr( val ); }
				format(string, 128, "cd%dExitY",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdExitY] = floatstr( val ); }
				format(string, 128, "cd%dExitZ",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdExitZ] = floatstr( val ); }
				format(string, 128, "cd%dMessage",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); strmid(CarDealershipInfo[f][cdMessage], val, 0, strlen(val)-1, 255); }
				format(string, 128, "cd%dTill",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdTill] = strval( val ); }
				format(string, 128, "cd%dInterior",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdInterior] = strval( val ); }
				format(string, 128, "cd%dVehicleSpawn0",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][0] = floatstr( val ); }
				format(string, 128, "cd%dVehicleSpawn1",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][1] = floatstr( val ); }
				format(string, 128, "cd%dVehicleSpawn2",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][2] = floatstr( val ); }
				format(string, 128, "cd%dVehicleSpawn3",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][3] = floatstr( val ); }
				format(string, 128, "cd%dRadius",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdRadius] = floatstr( val ); }
				format(string, 128, "cd%dPrice",f);
				if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdPrice] = strval( val ); }

				for(new fv = 0; fv < MAX_DEALERSHIPVEHICLES; fv++)
    			{
    			    format(string, 128, "cd%dVeh%dModelId",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleModel][fv] = strval( val ); }
					format(string, 128, "cd%dVeh%dCost",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleCost][fv] = strval( val ); }
					format(string, 128, "cd%dVeh%dSpawnX",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnX][fv] = floatstr( val ); }
					format(string, 128, "cd%dVeh%dSpawnY",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnY][fv] = floatstr( val ); }
					format(string, 128, "cd%dVeh%dSpawnZ",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnZ][fv] = floatstr( val ); }
					format(string, 128, "cd%dVeh%dSpawnA",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnAngle][fv] = floatstr( val ); }
					format(string, 128, "cd%dVeh%dColor1",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleColor1][fv] = strval( val ); }
					format(string, 128, "cd%dVeh%dColor2",f, fv);
					if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleColor2][fv] = strval( val ); }
    			}
			}
		}
		fclose(DealerFile);
	}
	return 1;
}
SavecDealerships()
{
	new string3[32];
	format(string3, sizeof(string3), "cardealerships.ini");
	new File: hFile = fopen(string3, io_write);
	if (hFile)
	{
		new var[32];
		for(new f = 0; f < MAX_CARDEALERSHIPS; f++)
   		{
			format(var, 32, "cd%dOwned=%d\n",f, CarDealershipInfo[f][cdOwned]); fwrite(hFile, var);
			format(var, 32, "cd%dOwner=%s\n",f, CarDealershipInfo[f][cdOwner]); fwrite(hFile, var);
			format(var, 32, "cd%dEntranceX=%.1f\n",f, CarDealershipInfo[f][cdEntranceX]); fwrite(hFile, var);
			format(var, 32, "cd%dEntranceY=%.1f\n",f, CarDealershipInfo[f][cdEntranceY]); fwrite(hFile, var);
			format(var, 32, "cd%dEntranceZ=%.1f\n",f, CarDealershipInfo[f][cdEntranceZ]); fwrite(hFile, var);
			format(var, 32, "cd%dExitX=%.1f\n",f, CarDealershipInfo[f][cdExitX]); fwrite(hFile, var);
			format(var, 32, "cd%dExitY=%.1f\n",f, CarDealershipInfo[f][cdExitX]); fwrite(hFile, var);
			format(var, 32, "cd%dExitZ=%.1f\n",f, CarDealershipInfo[f][cdExitX]); fwrite(hFile, var);
			format(var, 32, "cd%dMessage=%s\n\n",f, CarDealershipInfo[f][cdMessage]); fwrite(hFile, var);
			format(var, 32, "cd%dTill=%d\n",f, CarDealershipInfo[f][cdTill]); fwrite(hFile, var);
			format(var, 32, "cd%dInterior=%d\n",f, CarDealershipInfo[f][cdInterior]); fwrite(hFile, var);
			format(var, 32, "cd%dVehicleSpawn0=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][0]); fwrite(hFile, var);
			format(var, 32, "cd%dVehicleSpawn1=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][1]); fwrite(hFile, var);
			format(var, 32, "cd%dVehicleSpawn2=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][2]); fwrite(hFile, var);
			format(var, 32, "cd%dVehicleSpawn3=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][3]); fwrite(hFile, var);
			format(var, 32, "cd%dRadius=%.1f\n",f, CarDealershipInfo[f][cdRadius]); fwrite(hFile, var);
			format(var, 32, "cd%dPrice=%d\n",f, CarDealershipInfo[f][cdPrice]); fwrite(hFile, var);

			for(new fv = 0; fv < MAX_DEALERSHIPVEHICLES; fv++)
   			{
   			    format(var, 32, "cd%dVeh%dModelId=%d\n",f, fv, CarDealershipInfo[f][cdVehicleModel][fv]); fwrite(hFile, var);
				format(var, 32, "cd%dVeh%dCost=%d\n",f, fv,CarDealershipInfo[f][cdVehicleCost][fv]); fwrite(hFile, var);
				format(var, 32, "cd%dVeh%dSpawnX=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnX][fv]); fwrite(hFile, var);
				format(var, 32, "cd%dVeh%dSpawnY=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnY][fv]); fwrite(hFile, var);
				format(var, 32, "cd%dVeh%dSpawnZ=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnZ][fv]); fwrite(hFile, var);
				format(var, 32, "cd%dVeh%dSpawnA=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnAngle][fv]); fwrite(hFile, var);
				format(var, 32, "cd%dVeh%dColor1=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleColor1][fv]); fwrite(hFile, var);
				format(var, 32, "cd%dVeh%dColor2=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleColor2][fv]); fwrite(hFile, var);
    		}
  		}
		fclose(hFile);
	}
	return 1;
}
BEFORE I CREATE A DEALERSHIP


AFTER I CREATE A DEALERSHIP
Reply
#2

Bump.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)