22.11.2015, 11:39

Like the picture the same, how should I write such a script?
if(radius > VectorSize(SphereCenterX-playerX, SphereCenterY-playerY, SphereCenterZ-playerZ)) { GameTextForPlayer(playerid, "Stay within~r~ world boundries", 1000, 5); }
You need to use GetPlayerPos to obtain the coordinates of the player. Then compare it with your boundary coordinates to check if the player is within the range.
If you need a spherical range then you have to: Код:
if(radius > VectorSize(SphereCenterX-playerX, SphereCenterY-playerY, SphereCenterZ-playerZ)) { GameTextForPlayer(playerid, "Stay within~r~ world boundries", 1000, 5); } If you wanted to know how to send such text messages, you need to use GameTextForPlayer. The GameText Style/Type used in the picture is type 5. |
for(new i = GetPlayerPoolSize(); i >= 0; i--) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(100 > VectorSize(SphereCenterX - x, SphereCenterY - y, SphereCenterZ - Z)) { //Player is outside the boundary } }
You need to use GetPlayerPos to obtain the coordinates of the player. Then compare it with your boundary coordinates to check if the player is within the range.
If you need a spherical range then you have to: Код:
if(radius > VectorSize(SphereCenterX-playerX, SphereCenterY-playerY, SphereCenterZ-playerZ)) { GameTextForPlayer(playerid, "Stay within~r~ world boundries", 1000, 5); } If you wanted to know how to send such text messages, you need to use GameTextForPlayer. The GameText Style/Type used in the picture is type 5. |
Код:
for(new i = GetPlayerPoolSize(); i >= 0; i--) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(100 > VectorSize(SphereCenterX - x, SphereCenterY - y, SphereCenterZ - Z)) { //Player is outside the boundary } } Or another solution is to use streamer. It has a feature called dynamic areas. Its faster and easier but you'll have to learn about it. |