setworldbounds at a deathmatch
#1

hi all,

I've a little problem with a deathmatch area.
Im trying to make a deathmatch area, where people cant leave the area by using setworldbounds

My command:

if(strcmp(cmdtext, "/sniper", true) == 0)
{
new rand = random(sizeof(DMSniperSpawns));
new Playername[30], str[256];
GetPlayerName(playerid, Playername, 30);
format(str, 256, "%s has gone to the SniperDeathmatch type /sniper to join!!!", Playername);
SendClientMessageToAll(COLOR_RED, str);
SetPlayerPos(playerid, DMSniperSpawns[rand][0], DMSniperSpawns[rand][1], DMSniperSpawns[rand][2]); // Warp the player
SetPlayerFacingAngle(playerid, 270.0);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 34, 25);
SetPlayerHealth(playerid, 0.0);
SetPlayerHealth(playerid, 100.0);
SetPlayerInterior(playerid, 0);
SetPlayerColor(playerid,COLOR_BLANK);
SetPlayerWorldBounds(playerid, 2872.427, 2751.377, 1040.031, 850.4955);
return 1;


Problem: If people join this area they will fly all over las venturas and not stay in the specific area, i used x-treme san andreas ultimate mapper for make a worldbound.


p.s. : Trying to put the line under

public SetPlayerRandomSpawn(playerid)
{

dont work either

I hope someone can help me
Reply
#2

Yo need to put the player in the area, then set the world bounds, that way they wont fly all over LV
Reply
#3

can you give me a example pls?
Reply
#4

Use:
SetPlayerPos
to teleport the player to the DM area
Then do Setworldbounds after SetPlayerPos So for example it will be:

SetPlayerPos(playerid,x,y,z);
SetWorldBounds(playerid,...);
Reply
#5

SetWorldBounds --> not a working command

public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z; //We use this to store player position
for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
{
GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously
if (X <= 2872.427 && X >= 2751.377 && Y <= 1040.031 && Y >= 850.4955)
/* This line is the important one!. Here, is where you change those numbers, by the ones
you get from the /pos command. As you can see, those coordinates, are only the X and Y ones, the Z
doesnt matter*/
{
SetPlayerHealth(i, -999999.9); //This will ensure, that our player gets killed if he tries to enter
}
}
}

dont work aswell, or do i something wrong?
Reply
#6

Quote:
Originally Posted by smokey104
SetWorldBounds --> not a working command
SetPlayerWorldBounds*
Reply
#7

told it already in the first post

put it now under setplayerpos but still this problem -->

Problem: If people join this area they will fly all over las venturas and not stay in the specific area, i used x-treme san andreas ultimate mapper for make a worldbound.
Reply
#8

What do i wrong this time?
I search, search and search and try this option:


forward isPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy);

public OnFilterScriptInit()
{
SetTimer("IsPlayerInArea",10000,false);

public isPlayerInArea()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInArea(i, 2748.810791, 2498.679443, 2857.039550, 2704.64672) // seifs isplayerinarea used
{
SetPlayerWorldBounds(i, 2872.427, 2751.377, 1040.031, 850.4955); // xtreme mapper used
return 1;
}
}
return 1;
}

IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}
Reply
#9

new script didnt work either.



public isPlayerInArea()
{
new Float:X,Float:Y,Float:Z;
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i,X,Y,Z);
if(X <= 2748.810791 && X >= 2498.679443 && Y <= 2857.039550 && Y >= 2704.64672 // Checks the player area
{
SetPlayerWorldBounds(i, 2872.427, 2751.377, 1040.031, 850.4955);
GivePlayerWeapon(i, 32, 999);
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)