SA-MP Forums Archive
setworldbounds at a deathmatch - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: setworldbounds at a deathmatch (/showthread.php?tid=78949)



setworldbounds at a deathmatch - smokey104 - 24.05.2009

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



Re: setworldbounds at a deathmatch - miokie - 24.05.2009

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


Re: setworldbounds at a deathmatch - smokey104 - 24.05.2009

can you give me a example pls?


Re: setworldbounds at a deathmatch - miokie - 24.05.2009

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,...);


Re: setworldbounds at a deathmatch - smokey104 - 24.05.2009

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?



Re: setworldbounds at a deathmatch - miokie - 24.05.2009

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


Re: setworldbounds at a deathmatch - smokey104 - 24.05.2009

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.


Re: setworldbounds at a deathmatch - smokey104 - 24.05.2009

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;
}



Re: setworldbounds at a deathmatch - smokey104 - 24.05.2009

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;
}