[Help]SavePlayerCar & LoadPlayerCar
#1

Hello,

My pawn compiler keeps getting stuck when I try to compile my script. Has anyone any Idea what is wrong with the following script

Код:
public SavePlayerCar(playerid);
	{
		if(IsPlayerConnected(playerid))
		{
			new string3[64];
			new playername3[MAX_PLAYER_NAME];
			GetPlayerName(playerid, playername3, sizeof(playername3));
			format(string3, sizeof(string3), "ownablecars/%s.ini", playername3);
			new File: hFile = fopen(string3, io_write);
			if (hFile)
			{
			    new var[64];
				format(var, 64, "Veh1Model=%d\n",VehInfo[playerid][Veh1Model]);fwrite(hFile, var);
				format(var, 64, "Veh1Locationx=%f\n",VehInfo[playerid][Veh1Locationx]);fwrite(hFile, var);
				format(var, 64, "Veh1Locationy=%f\n",VehInfo[playerid][Veh1Locationy]);fwrite(hFile, var);
				format(var, 64, "Veh1Locationz=%f\n",VehInfo[playerid][Veh1Locationz]);fwrite(hFile, var);
				format(var, 64, "Veh1Angle=%f\n",VehInfo[playerid][Veh1Angle]);fwrite(hFile, var);
				format(var, 64, "Veh1ColorOne=%d\n",VehInfo[playerid][Veh1ColorOne]);fwrite(hFile, var);
				format(var, 64, "Veh1ColorTwo=%d\n",VehInfo[playerid][Veh1ColorTwo]);fwrite(hFile, var);
				format(var, 64, "Veh1Owner=%s\n",VehInfo[playerid][Veh1Owner]);fwrite(hFile, var);
				format(var, 64, "Veh1Alarm=%d\n",VehInfo[playerid][Veh1Alarm]);fwrite(hFile, var);
				format(var, 64, "Veh1Value=%d\n",VehInfo[playerid][Veh1Value]);fwrite(hFile, var);
				format(var, 64, "Veh1Lock=%d\n",VehInfo[playerid][Veh1Lock]);fwrite(hFile, var);
				format(var, 64, "Veh1Registration=%s\n",VehInfo[playerid][Veh1Registration]);fwrite(hFile, var);
				format(var, 64, "Veh1Owned=%d\n",VehInfo[playerid][Veh1Owned]);fwrite(hFile, var);
				format(var, 64, "Veh1Locked=%d\n",VehInfo[playerid][Veh1Locked]);fwrite(hFile, var);
				format(var, 64, "Veh2Model=%d\n",VehInfo[playerid][Veh2Model]);fwrite(hFile, var);
				format(var, 64, "Veh2Locationx=%f\n",VehInfo[playerid][Veh2Locationx]);fwrite(hFile, var);
				format(var, 64, "Veh2Locationy=%f\n",VehInfo[playerid][Veh2Locationy]);fwrite(hFile, var);
				format(var, 64, "Veh2Locationz=%f\n",VehInfo[playerid][Veh2Locationz]);fwrite(hFile, var);
				format(var, 64, "Veh2Angle=%f\n",VehInfo[playerid][Veh2Angle]);fwrite(hFile, var);
				format(var, 64, "Veh2ColorOne=%d\n",VehInfo[playerid][Veh2ColorOne]);fwrite(hFile, var);
				format(var, 64, "Veh2ColorTwo=%d\n",VehInfo[playerid][Veh2ColorTwo]);fwrite(hFile, var);
				format(var, 64, "Veh2Owner=%s\n",VehInfo[playerid][Veh2Owner]);fwrite(hFile, var);
				format(var, 64, "Veh2Alarm=%d\n",VehInfo[playerid][Veh2Alarm]);fwrite(hFile, var);
				format(var, 64, "Veh2Value=%d\n",VehInfo[playerid][Veh2Value]);fwrite(hFile, var);
				format(var, 64, "Veh2Lock=%d\n",VehInfo[playerid][Veh2Lock]);fwrite(hFile, var);
				format(var, 64, "Veh2Registration=%s\n",VehInfo[playerid][Veh2Registration]);fwrite(hFile, var);
				format(var, 64, "Veh2Owned=%d\n",VehInfo[playerid][Veh2Owned]);fwrite(hFile, var);
				format(var, 64, "Veh2Locked=%d\n",VehInfo[playerid][Veh2Locked]);fwrite(hFile, var);
				format(var, 64, "Veh3Model=%d\n",VehInfo[playerid][Veh3Model]);fwrite(hFile, var);
				format(var, 64, "Veh3Locationx=%f\n",VehInfo[playerid][Veh3Locationx]);fwrite(hFile, var);
				format(var, 64, "Veh3Locationy=%f\n",VehInfo[playerid][Veh3Locationy]);fwrite(hFile, var);
				format(var, 64, "Veh3Locationz=%f\n",VehInfo[playerid][Veh3Locationz]);fwrite(hFile, var);
				format(var, 64, "Veh3Angle=%f\n",VehInfo[playerid][Veh3Angle]);fwrite(hFile, var);
				format(var, 64, "Veh3ColorOne=%d\n",VehInfo[playerid][Veh3ColorOne]);fwrite(hFile, var);
				format(var, 64, "Veh3ColorTwo=%d\n",VehInfo[playerid][Veh3ColorTwo]);fwrite(hFile, var);
				format(var, 64, "Veh3Owner=%s\n",VehInfo[playerid][Veh3Owner]);fwrite(hFile, var);
				format(var, 64, "Veh3Alarm=%d\n",VehInfo[playerid][Veh3Alarm]);fwrite(hFile, var);
				format(var, 64, "Veh3Value=%d\n",VehInfo[playerid][Veh3Value]);fwrite(hFile, var);
				format(var, 64, "Veh3Lock=%d\n",VehInfo[playerid][Veh3Lock]);fwrite(hFile, var);
				format(var, 64, "Veh3Registration=%s\n",VehInfo[playerid][Veh3Registration]);fwrite(hFile, var);
				format(var, 64, "Veh3Owned=%d\n",VehInfo[playerid][Veh3Owned]);fwrite(hFile, var);
				format(var, 64, "Veh3Locked=%d\n",VehInfo[playerid][Veh3Locked]);fwrite(hFile, var);
				fclose(hFile);
			}
	}
	return 1;
}

public LoadPlayerCar(playerid);
	{
		if(IsPlayerConnected(playerid))
		{
		new tmp2[256];
	    new string2[64];
		new playername2[MAX_PLAYER_NAME];
		new playernamesplit[3][MAX_PLAYER_NAME];
	    GetPlayerName(playerid, playername2, sizeof(playername2));
	    split(playername2, playernamesplit, '_');
		format(string2, sizeof(string2), "ownablecars/%s.ini", playername2);
		new File: UserFile = fopen(string2, io_read);
				new key[ 256 ] , val[ 256 ];
			    new Data[ 256 ];
			    while ( fread( UserFile , Data , sizeof( Data ) ) )
				{
					key = ini_GetKey( Data );
					if( strcmp( key , "Veh1Model" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Model] = strval( val ); }
			    	if( strcmp( key , "Veh1Locationx" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Locationx] = floatstr( val ); }
			        if( strcmp( key , "Veh1Locationy" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Locationy] = floatstr( val ); }
			        if( strcmp( key , "Veh1Locationz" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Locationz] = floatstr( val ); }
			        if( strcmp( key , "Veh1Angle" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Angle] = floatstr( val ); }
			        if( strcmp( key , "Veh1ColorOne" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1ColorOne] = strval( val ); }
			        if( strcmp( key , "Veh1ColorTwo" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1ColorTwo] = strval( val ); }
			        if( strcmp( key , "Veh1Owner" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(VehInfo[playerid][Veh1Owner], val, 0, strlen(val)-1, 255); }
			        if( strcmp( key , "Veh1Alarm" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Alarm] = strval( val ); }
			        if( strcmp( key , "Veh1Value" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Value] = strval( val ); }
			        if( strcmp( key , "Veh1Lock" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Lock] = strval( val ); }
			        if( strcmp( key , "Veh1Registration" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(VehInfo[playerid][Veh1Registration], val, 0, strlen(val)-1, 255); }
			        if( strcmp( key , "Veh1Owned" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Owned] = strval( val ); }
			        if( strcmp( key , "Veh1Locked" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh1Locked] = strval( val ); }
			        if( strcmp( key , "Veh2Model" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Model] = strval( val ); }
			    	if( strcmp( key , "Veh2Locationx" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Locationx] = floatstr( val ); }
			        if( strcmp( key , "Veh2Locationy" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Locationy] = floatstr( val ); }
			        if( strcmp( key , "Veh2Locationz" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Locationz] = floatstr( val ); }
			        if( strcmp( key , "Veh2Angle" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Angle] = floatstr( val ); }
			        if( strcmp( key , "Veh2ColorOne" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2ColorOne] = strval( val ); }
			        if( strcmp( key , "Veh2ColorTwo" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2ColorTwo] = strval( val ); }
			        if( strcmp( key , "Veh2Owner" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(VehInfo[playerid][Veh2Owner], val, 0, strlen(val)-1, 255); }
			        if( strcmp( key , "Veh2Alarm" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Alarm] = strval( val ); }
			        if( strcmp( key , "Veh2Value" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Value] = strval( val ); }
			        if( strcmp( key , "Veh2Lock" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Lock] = strval( val ); }
			        if( strcmp( key , "Veh2Registration" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(VehInfo[playerid][Veh2Registration], val, 0, strlen(val)-1, 255); }
			        if( strcmp( key , "Veh2Owned" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Owned] = strval( val ); }
			        if( strcmp( key , "Veh2Locked" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh2Locked] = strval( val ); }
			        if( strcmp( key , "Veh3Model" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Model] = strval( val ); }
			    	if( strcmp( key , "Veh3Locationx" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Locationx] = floatstr( val ); }
			        if( strcmp( key , "Veh3Locationy" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Locationy] = floatstr( val ); }
			        if( strcmp( key , "Veh3Locationz" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Locationz] = floatstr( val ); }
			        if( strcmp( key , "Veh3Angle" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Angle] = floatstr( val ); }
			        if( strcmp( key , "Veh3ColorOne" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3ColorOne] = strval( val ); }
			        if( strcmp( key , "Veh3ColorTwo" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3ColorTwo] = strval( val ); }
			        if( strcmp( key , "Veh3Owner" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(VehInfo[playerid][Veh3Owner], val, 0, strlen(val)-1, 255); }
			        if( strcmp( key , "Veh3Alarm" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Alarm] = strval( val ); }
			        if( strcmp( key , "Veh3Value" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Value] = strval( val ); }
			        if( strcmp( key , "Veh3Lock" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Lock] = strval( val ); }
			        if( strcmp( key , "Veh3Registration" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(VehInfo[playerid][Veh3Registration], val, 0, strlen(val)-1, 255); }
			        if( strcmp( key , "Veh3Owned" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Owned] = strval( val ); }
			        if( strcmp( key , "Veh3Locked" , true ) == 0 ) { val = ini_GetValue( Data ); VehInfo[playerid][Veh3Locked] = strval( val ); }
                }//end while
                fclose(UserFile);//close the file after everything has been read in the while
		   }
	return 1;
	}
Please help me
Reply


Messages In This Thread
[Help]SavePlayerCar & LoadPlayerCar - by Kastranova - 02.01.2011, 13:30
Re: [Help]SavePlayerCar & LoadPlayerCar - by _rAped - 02.01.2011, 15:18
Re: [Help]SavePlayerCar & LoadPlayerCar - by Kastranova - 03.01.2011, 05:55

Forum Jump:


Users browsing this thread: 1 Guest(s)