Problems with Boundaries, Help!
#1

Well, I am trying to script a place where people can Stunt etc.
But I have allowed tanks to be there, so I do not wish for them to leave the area...
I don't do boundaries much, if not, never, so I struggle with them

Код:
if(strcmp(cmdtext, "/stuntroof", true) == 0 || strcmp(cmdtext, "/sr", true) == 0) // Stunt Roof
{
SetPlayerPos(playerid, -1456.4884,403.0696,30.0859);
SetPlayerWorldBounds(playerid, 20.0, -20.0, 20.0, -20.0);
ResetPlayerWeapons(playerid);
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, 100);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, COLOR_PURPLE, "You have Teleported to Stunt Roof");
SetPlayerFacingAngle(playerid, 86.7776);
new name[24];
new string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "*** %s has teleported to Stunt Roof (/sr) || (/stuntroof).", name);
SendClientMessageToAll(COLOR_GRAYTEXT, string);
return 1;
}
You see, I am merely testing this, but the problem is, when they teleport there, it decides to come up with
"Stay within the world boundaries"
Then it pulls me away from the teleport location...
This is frustrating me, as the main part of my script requires boundaries, so please someone lend a hand

Oh yeah, I forgot, it compiles A-Ok, so I just need to really know how to set proper boundaries
Reply
#2

this is the idea
x-max x-min
|-----|
| |
|-----|
y-max y-min

https://sampwiki.blast.hk/wiki/SetPlayerWorldBounds

* I"M NOT 100 % Sure but it's worth a try. *
Reply
#3

Quote:
Originally Posted by AppLeAppLeAppLe(AlExAlExAlEx)
this is the idea
x-max x-min
|-----|
| |
|-----|
y-max y-min

https://sampwiki.blast.hk/wiki/SetPlayerWorldBounds

* I"M NOT 100 % Sure but it's worth a try. *
But I mean, when I teleport, I have traveled no distance at all... But it still pulls me away
I don't know how to set the play boundaries specifically on that teleport...
I think the boundary is being set on the spawn place or the spawn selection place...
Reply
#4

Any help please?
Reply
#5

Y /\
|
|____>
0 X

_TheOne_

Let use look in your code
pawn Код:
//...
SetPlayerPos(playerid, -1456.4884,403.0696,30.0859);
SetPlayerWorldBounds(playerid, 20.0, -20.0, 20.0, -20.0);
//...
What we see ?
We see that the player gets teleported to -1456.4884,403.0696,30.0859
And we see that the boundary at set to 20.0, -20.0, 20.0, -20.0 (that is a small area around the 0.0 point (the big farm))

What we need to do ?
We need to change / delete the function which set the boundary
pawn Код:
SetPlayerPos(playerid, -1456.4884,403.0696,30.0859);
SetPlayerWorldBounds(playerid, -1455.0, -1457.0, 404.0, 402.0);
With that you can move more or less 1 meter before you get checked back
But that you dont want, so we make a new and better editable code
pawn Код:
new Float:Cords[3] = { -1456.4884, 403.0696, 30.0859 },
    Float:AreaSize = 1.0,
SetPlayerPos(playerid, Cords[0], Cords[1], Cords[2]);
SetPlayerWorldBounds(playerid, Cords[0] + AreaSize, Cords[0] - AreaSize, Cords[1] + AreaSize, Cords[1] - AreaSize);
So now you can easy edit the cords or the AreaSize
Reply
#6

i reccommend downloading xtreme vehicle plotter - it makes this very easy.
Reply
#7

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Y /\
|
|____>
0 X

_TheOne_

Let use look in your code
pawn Код:
//...
SetPlayerPos(playerid, -1456.4884,403.0696,30.0859);
SetPlayerWorldBounds(playerid, 20.0, -20.0, 20.0, -20.0);
//...
What we see ?
We see that the player gets teleported to -1456.4884,403.0696,30.0859
And we see that the boundary at set to 20.0, -20.0, 20.0, -20.0 (that is a small area around the 0.0 point (the big farm))

What we need to do ?
We need to change / delete the function which set the boundary
pawn Код:
SetPlayerPos(playerid, -1456.4884,403.0696,30.0859);
SetPlayerWorldBounds(playerid, -1455.0, -1457.0, 404.0, 402.0);
With that you can move more or less 1 meter before you get checked back
But that you dont want, so we make a new and better editable code
pawn Код:
new Float:Cords[3] = { -1456.4884, 403.0696, 30.0859 },
    Float:AreaSize = 1.0,
SetPlayerPos(playerid, Cords[0], Cords[1], Cords[2]);
SetPlayerWorldBounds(playerid, Cords[0] + AreaSize, Cords[0] - AreaSize, Cords[1] + AreaSize, Cords[1] - AreaSize);
So now you can easy edit the cords or the AreaSize
Ahh no worries mate, I needed a really quick response, so I just went elsewhere and found out
And is good now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)