Thanks for helping, the command works now, but wherever I enter it it displays the "Error! Not on sphere!" message. I tried standing on the sphere, out of it, even tried standing on the other sphere I have in the server, but always the Error message.
Correct me if I'm wrong, but maybe it's just too hard to stay at the exact x, y, z position of the sphere center?
Edit: A friend helped me get it working.
Here is the fixed script:
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "buy" )
{
local mySphere = FindSphere( 0 );
if ( ( mySphere ) && ( GetDistance( mySphere.Pos, player.Pos ) < 4.0 ) )
{
Message( "Success!" );
}
else Message( "Error! Not on sphere!" );
}
return 1;
}
Thanks for taking the time to help me though!