SA-MP Forums Archive
Need help with /enter and /exit - 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: Need help with /enter and /exit (/showthread.php?tid=551775)



Need help with /enter and /exit - danielpalade - 20.12.2014

So, I am trying to make the commands /enter and /exit to make a player exit and enter the spawn.
But for some reason the player won't spawn outside or inside, it just stays in the same position.
This is my code:

Код:
CMD:enter(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 3.0, 1685.0341,-1343.4779,17.4349))
	{
	    if(pInfo[playerid][Sex] == 1)
	    {
	        SetSpawnInfo(playerid, 0, 3, 161.4045, -95.8079, 1001.8047, 347.3583, 0, 0, 0, 0, 0, 0);
	        SetPlayerInterior(playerid, 18);
	        SpawnPlayer(playerid);
	    }
		if(pInfo[playerid][Sex] == 2)
		{
		    SetSpawnInfo(playerid, 0, 11, 161.4045, -95.8079, 1001.8047, 347.3583, 0, 0, 0, 0, 0, 0);
		    SetPlayerInterior(playerid, 18);
		    SpawnPlayer(playerid);
		}
	}
	return 1;
}
CMD:exit(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 3.0, 161.4045, -95.8079, 1001.8047))
	{
	    if(pInfo[playerid][Sex] == 1)
	    {
	        SetSpawnInfo(playerid, 0, 3, 1685.0341, -1343.4779, 17.4349, 274.0744, 0, 0, 0, 0, 0, 0);
	        SetPlayerInterior(playerid, 0);
	        SpawnPlayer(playerid);
	    }
	    if(pInfo[playerid][Sex] == 2)
	    {
	        SetSpawnInfo(playerid, 0, 11, 1685.0341, -1343.4779, 17.4349, 274.0744, 0, 0, 0, 0, 0, 0);
	        SetPlayerInterior(playerid, 0);
	        SpawnPlayer(playerid);
	    }
	}
	return 1;
}



Re: Need help with /enter and /exit - Blademaster680 - 21.12.2014

You are setting their spawn information but you not actually spawning them... use SpawnPlayer(playerid); after the setspawninfo


Re: Need help with /enter and /exit - danielpalade - 21.12.2014

Quote:
Originally Posted by Blademaster680
Посмотреть сообщение
You are setting their spawn information but you not actually spawning them... use SpawnPlayer(playerid); after the setspawninfo
I have updated the Code, but i have another problem. If your gender is "Female" and you use/exit. It won't work.


Re: Need help with /enter and /exit - 1fret - 21.12.2014

Not sure if this is right but
Change this
pawn Код:
if(pInfo[playerid][Sex] == 2)
To this
pawn Код:
else  if(pInfo[playerid][Sex] == 2)



Re: Need help with /enter and /exit - danielpalade - 21.12.2014

Quote:
Originally Posted by 1fret
Посмотреть сообщение
Not sure if this is right but
Change this
pawn Код:
if(pInfo[playerid][Sex] == 2)
To this
pawn Код:
else  if(pInfo[playerid][Sex] == 2)
Nope it doesn't work :/


Re: Need help with /enter and /exit - cyberlord - 21.12.2014

Why u are not using SetPlayerPos ? i have using this one for enter exit and its works for my fine , or u can use iee
to create enter exit point without typing anything , or another way to do this u can use enter key to enter or exit