IsPlayerInRangeOfPoint Teleport Help -
<Weponz> - 19.11.2010
The code works fine but seems to bug after you do it once works fine the 1st time but the 2nd it dont work and sometimes it just dont work at all can someone look at it and try see problem plz :S
pawn Код:
public OnGameModeInit()
{
SetTimer("Check", 500, true);
return 1;
}
forward Check(playerid);
public Check(playerid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInRangeOfPoint(i, 2,2305.9927,-16.2388,26.7496))
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2271.6396,2289.1282,10.8203);
}
}
return 1;
}
Thanks in advanced
Re: IsPlayerInRangeOfPoint Teleport Help -
The_Moddler - 19.11.2010
pawn Код:
public OnGameModeInit()
{
SetTimer("Check", 2500, 1);
return 1;
}
forward Check();
public Check()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 2.0, 2305.9927, -16.2388, 26.7496))
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2271.6396,2289.1282,10.8203);
}
}
}
return 1;
}
Re: IsPlayerInRangeOfPoint Teleport Help -
<Weponz> - 19.11.2010
Quote:
Originally Posted by The_Moddler
pawn Код:
public OnGameModeInit() { SetTimer("Check", 2500, 1); return 1; }
forward Check(); public Check() { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(IsPlayerInRangeOfPoint(i, 2.0, 2305.9927, -16.2388, 26.7496)) { SetPlayerInterior(playerid, 0); SetPlayerPos(playerid, 2271.6396,2289.1282,10.8203); } } } return 1; }
|
can u explain why that 3rd brace and IsPlayerConnected and changing from half a sec to 2 and a half secs fixes it?
Re: IsPlayerInRangeOfPoint Teleport Help -
The_Moddler - 19.11.2010
3rd brace is to close IsPlayerConnected.
IsPlayerConnected is to check if the player is connected, and if he is, you check his position, so like that the script will be faster.
I changed it to 2 seconds becouse it's no nesessary to check each 500ms if a player is in an area, if you want change it to 5 secs.
Re: IsPlayerInRangeOfPoint Teleport Help -
<Weponz> - 19.11.2010
Its still bugs when another person trys to use the teleport :S
Someone plz help
Re: IsPlayerInRangeOfPoint Teleport Help -
MadeMan - 19.11.2010
pawn Код:
public Check()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 2.0, 2305.9927, -16.2388, 26.7496))
{
SetPlayerInterior(i, 0);
SetPlayerPos(i, 2271.6396,2289.1282,10.8203);
}
}
}
}
change playerid to i
Re: IsPlayerInRangeOfPoint Teleport Help -
The_Moddler - 19.11.2010
Quote:
Originally Posted by MadeMan
pawn Код:
public Check() { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(IsPlayerInRangeOfPoint(i, 2.0, 2305.9927, -16.2388, 26.7496)) { SetPlayerInterior(i, 0); SetPlayerPos(i, 2271.6396,2289.1282,10.8203); } } } }
change playerid to i
|
LOL I didn't notice that! XD
Re: IsPlayerInRangeOfPoint Teleport Help -
randomkid88 - 19.11.2010
You don't really need IsPlayerConnected because IsPlayerInRangeOfPoint has an internal IsPlayerConnected, so it isn't really more effecient and doesn't accomplish anything extra (according to ******'s Code Optimization post). Also, you might want to look into foreach.
Re: IsPlayerInRangeOfPoint Teleport Help -
The_Moddler - 19.11.2010
Quote:
Originally Posted by randomkid88
You don't really need IsPlayerConnected because IsPlayerInRangeOfPoint has an internal IsPlayerConnected, so it isn't really more effecient and doesn't accomplish anything extra (according to ******'s Code Optimization post). Also, you might want to look into foreach.
|
Ah, I didn't know that.. can you link where it says that?
Thanks!
Re: IsPlayerInRangeOfPoint Teleport Help -
randomkid88 - 20.11.2010
http://forum.sa-mp.com/showthread.ph...ayer+functions
Its under the foreach section. But while there you might as well read the whole thing.