You're on the right track.
NPC Code:
showimg(200, "block.png", 30, 30);
changeImgVis(200, 0);
That would work in the "traditional" way (ie, in GS1 that is how you'd need to do it, minus the quotes and parentheses).
NPC Code:
temp.img = showimg(200, "block.png", 30, 30);
img.layer = 0;
.. would be a nice way to do it in GS2. However,
NPC Code:
showimg(200, "block.png", 30, 30).layer = 0;
would also work.
The reason yours didnt work is because you tried -1. -1 and floats don't work. In addition, visibility above 4 will draw to the player's screen's XY, so be wary of that.
Finally, be careful when dealing with showimg indices lower than 200, as they by default will show serverside unless disabled in server options. As a method of protocol, tend to start with image indices greater or equal to 200.
One final tip, if I may, is that if you want fractional-layer showimg, use showimg2.
For example, if you want 2 images to draw under player, but img1 to draw under img2, give img1 a 'z' value of 1 (and increase its y by 1 to compensate, so it doesn't move). Due to its higher z, it'll draw over the other image on the 0-layer, but it'll still draw under players on the 1-layer.