Both versions wont work, and the first version by EvilSOB doesnt work either. Reason is wrong use of the vector(...) function:
http://manual.conitec.net/avector.htm This is a temporary vector only, it exists only on the stack and will get overwritten by another vector(...) call later and then your content is destroyed.
Here is how to do it right:
function DoSomeThing()
{
...
VECTOR vtarget;
vec_set(vtarget,vector(mouse_cursor.x,mouse_cursor.y,800));
...
}
This will work also:
function DoSomeThing()
{
...
VECTOR* vtarget = { x=0; y=0; z=0; }
vec_set(vtarget,vector(mouse_cursor.x,mouse_cursor.y,800));
...
}
For filling a vector you use vec_set and not '=', and dont name a vector "target" because that name is already reserved by an engine variable.