SA-MP Forums Archive
Exiting interiors - 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)
+--- Thread: Exiting interiors (/showthread.php?tid=583498)



Exiting interiors - SquirrelLSRP - 28.07.2015

Okay. I've noticed this bug on my server. Whenever I'm inside any interior and type /exit, it will TP me way out into the country. How would I go about fixing this?


Re: Exiting interiors - Dan. - 28.07.2015

Show us the /exit command code.

It probably doesn't know where to put you and just teleports you to 0.0 coordinates which are near in the country, near a farm.


Re: Exiting interiors - SquirrelLSRP - 28.07.2015

That might be the case.

Код HTML:
CMD:exit(playerid, params[])
{
	for(new i=0; i < MAX_DOORS; i++)
	{
	    if(!IsPlayerInRangeOfPoint(playerid, 2.0, DoorInfo[i][dInteriorX], DoorInfo[i][dInteriorY], DoorInfo[i][dInteriorZ]) && DoorInfo[i][dInteriorInt] == GetPlayerInterior(playerid) && DoorInfo[i][dInteriorVir] == GetPlayerVirtualWorld(playerid)) continue;
	    SetPlayerInterior(playerid, DoorInfo[i][dExteriorInt]);
	    SetPlayerVirtualWorld(playerid, DoorInfo[i][dExteriorVir]);
	    SetPlayerPos(playerid, DoorInfo[i][dExteriorX], DoorInfo[i][dExteriorY], DoorInfo[i][dExteriorZ]);
	    SetPlayerFacingAngle(playerid, DoorInfo[i][dExteriorAngle]);
	    SetCameraBehindPlayer(playerid);
	}
 	for(new i = 0; i < MAX_HOUSES; i++)
  	{
   			if(InHouse[playerid][i] == 1)
      		{
        		SetPlayerPos(playerid, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]);
          		SetPlayerInterior(playerid, 0);
          		InHouse[playerid][i] = 0;
            }
	}
 	for(new i = 0; i < MAX_BIZZES; i++)
  	{
   			if(InBiz[playerid][i] == 1)
      		{
        		SetPlayerPos(playerid, BizInfo[i][bX], BizInfo[i][bY], BizInfo[i][bZ]);
          		SetPlayerInterior(playerid, 0);
          		InBiz[playerid][i] = 0;
            }
	}
  	{
        	if(IsPlayerInRangeOfPoint(playerid, 2.2, -1856.7942,43.2261,1055.1687)) // AIRPORT
      		{
        		SetPlayerPos(playerid, 1642.1957, -2334.4849, 13.5469);
	    		SetPlayerFacingAngle(playerid, 0.0);
          		SetPlayerInterior(playerid, 0);
				ClearScreen(playerid);

	      		SendClientMessage(playerid, COLOR_ORANGE2, "__________{ffa500}SPAWN{ffa500}__________");
        		SendClientMessage(playerid, -1, "You have been given {ffa500}$"SPAWN_MONEY"{FFFFFF} to start off. If you need any help regarding the script");
        		SendClientMessage(playerid, -1, "you can use {ffa500}/help{FFFFFF} or {ffa500}/n{FFFFFF}. Since this is a new server, you have also recieved");
        		SendClientMessage(playerid, -1, "{ffa500}$"SPAWN_BONUS"{FFFFFF} bonus cash in your bank. Thank you for playing "SERVER_NAME".");
          }
	}
  	{
        	if(IsPlayerInRangeOfPoint(playerid, 5.0, 772.2415,-4.7547,1000.7287)) // GANTON GYM
      		{
        		SetPlayerPos(playerid, 2229.7529,-1721.4796,13.5634);
          		SetPlayerInterior(playerid, 0);
            }
	}
  	{
        	if(IsPlayerInRangeOfPoint(playerid, 5.0, 408.4801,-1620.2821,1507.8569)) // STAGE 25
      		{
        		SetPlayerPos(playerid, 648.9583,-1353.9291,13.5472);
          		SetPlayerInterior(playerid, 0);
            }
	}
  	{
        	if(IsPlayerInRangeOfPoint(playerid, 5.0, 2305.7944,-16.3430,26.7496)) // BANK
      		{
        		SetPlayerPos(playerid, 1457.0853,-1009.9203,26.8438);
          		SetPlayerInterior(playerid, 0);
            }
	}
  	{
        	if(IsPlayerInRangeOfPoint(playerid, 5.0, 390.0780,173.9001,1008.3828)) // City Hall
      		{
        		SetPlayerPos(playerid, 1481.0234,-1772.1077,18.7958);
          		SetPlayerInterior(playerid, 0);
            }
	}
  	{
        	if(IsPlayerInRangeOfPoint(playerid, 5.0, 207.8441,-110.9630,1005.1328)) // City Hall
      		{
        		SetPlayerPos(playerid, 2244.3423,-1665.5542,15.4766);
          		SetPlayerInterior(playerid, 0);
            }
	}
  	{
        	if(IsPlayerInRangeOfPoint(playerid, 5.0, -2029.8304,-119.1431,1035.1719)) // DMV
      		{
        		SetPlayerPos(playerid, 2045.5867,-1907.9515,13.5469);
          		SetPlayerInterior(playerid, 0);
            }
	}
	return 1;
}



Re: Exiting interiors - Dan. - 28.07.2015

Try this:
Код:
for(new i=0; i < MAX_DOORS; i++)
	{
	    if(!IsPlayerInRangeOfPoint(playerid, 2.0, DoorInfo[i][dInteriorX], DoorInfo[i][dInteriorY], DoorInfo[i][dInteriorZ]) && DoorInfo[i][dInteriorInt] == GetPlayerInterior(playerid) && DoorInfo[i][dInteriorVir] == GetPlayerVirtualWorld(playerid)) continue;
	    SetPlayerInterior(playerid, DoorInfo[i][dExteriorInt]);
	    SetPlayerVirtualWorld(playerid, DoorInfo[i][dExteriorVir]);
	    SetPlayerPos(playerid, DoorInfo[i][dExteriorX], DoorInfo[i][dExteriorY], DoorInfo[i][dExteriorZ]);
      printf("ExteriorX: %f, ExteriorY: %f, ExteriorZ: %f", DoorInfo[i][dExteriorX], DoorInfo[i][dExteriorY], DoorInfo[i][dExteriorZ])
	    SetPlayerFacingAngle(playerid, DoorInfo[i][dExteriorAngle]);
	    SetCameraBehindPlayer(playerid);
	}
Go in-game, use the /exit command and check what the server console is printing you.


Re: Exiting interiors - SquirrelLSRP - 29.07.2015

Quote:
Originally Posted by Dan.
Посмотреть сообщение
Try this:
Код:
for(new i=0; i < MAX_DOORS; i++)
	{
	    if(!IsPlayerInRangeOfPoint(playerid, 2.0, DoorInfo[i][dInteriorX], DoorInfo[i][dInteriorY], DoorInfo[i][dInteriorZ]) && DoorInfo[i][dInteriorInt] == GetPlayerInterior(playerid) && DoorInfo[i][dInteriorVir] == GetPlayerVirtualWorld(playerid)) continue;
	    SetPlayerInterior(playerid, DoorInfo[i][dExteriorInt]);
	    SetPlayerVirtualWorld(playerid, DoorInfo[i][dExteriorVir]);
	    SetPlayerPos(playerid, DoorInfo[i][dExteriorX], DoorInfo[i][dExteriorY], DoorInfo[i][dExteriorZ]);
      printf("ExteriorX: %f, ExteriorY: %f, ExteriorZ: %f", DoorInfo[i][dExteriorX], DoorInfo[i][dExteriorY], DoorInfo[i][dExteriorZ])
	    SetPlayerFacingAngle(playerid, DoorInfo[i][dExteriorAngle]);
	    SetCameraBehindPlayer(playerid);
	}
Go in-game, use the /exit command and check what the server console is printing you.
As an alternative, I've totally removed my door system as it was buggy anyways. I'll redo it later. Thank you anyways, +repped.


Re: Exiting interiors - Abagail - 29.07.2015

To be honest, that seems a bit like the NG:RP door system which itself is very inefficient. You should consider basing it off the pickup & or object ID model to save the need for looping everytime a player attempts to enter / exit whatever a door.


Re: Exiting interiors - SquirrelLSRP - 29.07.2015

Quote:
Originally Posted by Abagail
Посмотреть сообщение
To be honest, that seems a bit like the NG:RP door system which itself is very inefficient. You should consider basing it off the pickup & or object ID model to save the need for looping everytime a player attempts to enter / exit whatever a door.
As I said above, I totally removed it. It's going to be re-done. And nothing from my script was from NG:RP, it's complete scratch.


Re: Exiting interiors - SoFahim - 29.07.2015

Quote:
Originally Posted by SquirrelLSRP
Посмотреть сообщение
As I said above, I totally removed it. It's going to be re-done. And nothing from my script was from NG:RP, it's complete scratch.
Quote:

othing from my script was from NG:RP, it's complete scratch

Really ? Complete scratch ? :O srsly ?