for testing, i decreases the function and i use draw_point3d to verify if the location of the coordinates 3D were correct.
It worked perfectly, and the 3Dpoints were placed exactly in the desired locations.

Code:
function terrain_paintest(...)
{
		

	if(!skin) skin = ent_getskin(terrain,1);

	var range = 64;
	
	var format = bmap_lock(skin,0);	
	var i,j,fx,fy,ex,ey;	
	
        //x and y is the mouse cordenate in word 3D
	fx = x -range; //X from
	ex = x + range; //Y from	
	
	fy = y - range; //X End
	ey = y + range; //Y End
	
	for(j=fx; j<= ex; j++)
	for(i=fy; i<= ey; i++)
	{		
		
		if(vec_dist(_vec(x,y,0),_vec(j,i,0))<=(range/2))
		{			
	
			draw_point3d(_vec(j,i,2), _vec(0,0,255), 100,2);
			
			
		}
		
		
	}	

	
}




So the problem really is in receiving the correct coordinates of pixels!
Can anyone help me?

Using the same function but now instead of using points i use terrain_setpixel(terrain,j,i,skin,color);[b][/b]
the positions of the painting are wrong!. no WOrk Fine.

Code:
for(j=fx; j<= ex; j++)
	for(i=fy; i<= ey; i++)
	{		
		
		if(vec_dist(_vec(x,y,0),_vec(j,i,0))<=(range/2))
		{			
	        //no working fine
		terrain_setpixel(terrain,j,i,skin,color);
			
			
		}
		
		
	}


Last edited by NeoNeper; 07/11/13 22:08.

Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________