SA-MP Forums Archive
Problem with IsPlayerInCube - 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: Problem with IsPlayerInCube (/showthread.php?tid=166592)



Problem with IsPlayerInCube - Loppa - 09.08.2010

Well this is the script
Код:
stock IsPlayerInCube(playerid, Float:xmin, Float:ymin, Float:zmin, Float:xmax, Float:ymax, Float:zmax)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	if(x > xmin && y > ymin && z > zmin && x < xmax && y < ymax && z < zmax)return 1;
	return 0;
}
Код:
 
public Mine()
{
for(new i=0; i<=MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInCube(i, 72.1256, 1544.2145, 15.7742, 75.2350, 1546.3352, 16.4206)) 
{
new Float:posx, Float:posy, Float:posz;
GetPlayerPos(i, posx, posy, posz);
SetPlayerHealth(i, 0);
CreateExplosion(posx, posy, posz, 3, 5);
}
}
return 1;
}
But it doesn't work. And i know that the problem is the function IsPlayerInCube because if i use IsPlayerInRangeOfPoint instead of it it works without problems. Well the problem is that i can't use that because the bomb must be hidden under a bridge but it doesn't have to explode who is over the bridge. So the only way is to use IsPlayerInCube.


Re: Problem with IsPlayerInCube - r0b - 09.08.2010

Um, it wont explode on the bridge, you have 3D coords, so..cant explain more, bad english. :P
Did you tried that it will explode on the bridge too?


Re: Problem with IsPlayerInCube - Owenlishious - 11.09.2010

i think it would work if you add a timer...

the timer checks if the player is in the cube or not