OnPlayerInteriorChange help
#1

I have OnPlayerInteriorChange in my GM but it is not doing what it's supposed too.

This is what i have, The first one "if(oldinteriorid == 3 && newinteriorid == 0)" Is doing what it's supposed to by placing the player at a specific position

but my other one isnt.... " if(oldinteriorid == 4 && newinteriorid == 0)"



Heres my whole code:

Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
 if(oldinteriorid == 3 && newinteriorid == 0)
{
	if(GetPlayerVirtualWorld(playerid) == 1)
	{
		SetPlayerVirtualWorld(playerid,0);
  	//SetPlayerInterior(playerid,0);
  	SetPlayerPos(playerid,1877.6157,-1740.8281,13.4860);
  	SetPlayerFacingAngle(playerid,187.0764);
  	SetCameraBehindPlayer(playerid);
  	LeftTwoFourSeven[playerid] =1;
  	TimeToMoveTwoFourSeven[playerid] =3;
  	TogglePlayerControllable(playerid, 0);
}
 if(oldinteriorid == 4 && newinteriorid == 0)
{
  if(GetPlayerVirtualWorld(playerid) == 2)
	{
  	SetPlayerVirtualWorld(playerid,0);
  	//SetPlayerInterior(playerid,0);
  	SetPlayerPos(playerid,1933.4030,-1776.1339,13.3828);
  	SetPlayerFacingAngle(playerid,272.7751);
  	SetCameraBehindPlayer(playerid);
  	LeftTwoFourSeven[playerid] =2;
  	TimeToMoveTwoFourSeven[playerid] =3;
  	TogglePlayerControllable(playerid, 0);
  }
	}
	}
	return 1;
}
Код:
public twofoursevenmoveplayer()
{
  for (new i = 0; i < MAX_PLAYERS; i++)
  {
	if(IsPlayerConnected(i) && IsSpawned[i] == 1 && GetPlayerInterior(i) == 0 && Jailed[i] == 0)
	{
	if(TimeToMoveTwoFourSeven[i] >=1 && TimeToMoveTwoFourSeven[i] <=3)
	{
	TimeToMoveTwoFourSeven[i] --;
	}
	if(TimeToMoveTwoFourSeven[i] == 0)
	{
	if(LeftTwoFourSeven[i] == 1)
	{
		SetPlayerVirtualWorld(i,0);
  	SetPlayerInterior(i,0);
  	SetPlayerPos(i,1592.2305,2214.1846,10.8203);
  	SetPlayerFacingAngle(i,187.0764);
  	SetCameraBehindPlayer(i);
  	LeftTwoFourSeven[i] =999;
  	TimeToMoveTwoFourSeven[i] =999;
  	TogglePlayerControllable(i, 1);
  	}
  if(LeftTwoFourSeven[i] == 2)
	{
  	SetPlayerVirtualWorld(i,0);
  	SetPlayerInterior(i,0);
  	SetPlayerPos(i,2191.6472,2476.4624,10.8203);
  	SetPlayerFacingAngle(i,272.7751);
  	SetCameraBehindPlayer(i);
  	LeftTwoFourSeven[i] =999;
  	TimeToMoveTwoFourSeven[i] =999;
  	TogglePlayerControllable(i, 1);
  }
  }
}
Reply
#2

I'd also like to know this
Reply
#3

pawn Код:
if(oldinteriorid == 3 && newinteriorid == 0)
{
    if(GetPlayerVirtualWorld(playerid) == 1)
    {
        SetPlayerVirtualWorld(playerid,0);
    //SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,1877.6157,-1740.8281,13.4860);
    SetPlayerFacingAngle(playerid,187.0764);
    SetCameraBehindPlayer(playerid);
    LeftTwoFourSeven[playerid] =1;
    TimeToMoveTwoFourSeven[playerid] =3;
    TogglePlayerControllable(playerid, 0);
}

You're missing a closing brace here
Reply
#4

it's not a closing brace problem....he didnt say theres any errors
Reply
#5

i don't understand....If theres a closing brace problem wouldn't there be errors....It's just not doing what it's supposed to be which is teleporting me from one place to another when exiting through yellow marker


Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
 if(oldinteriorid == 3 && newinteriorid == 0)
{
	if(GetPlayerVirtualWorld(playerid) == 1)
	{
		SetPlayerVirtualWorld(playerid,0);
  	//SetPlayerInterior(playerid,0);
  	SetPlayerPos(playerid,1877.6157,-1740.8281,13.4860);
  	SetPlayerFacingAngle(playerid,187.0764);
  	SetCameraBehindPlayer(playerid);
  	LeftTwoFourSeven[playerid] =1;
  	TimeToMoveTwoFourSeven[playerid] =3;
  	TogglePlayerControllable(playerid, 0);
}
 if(oldinteriorid == 4 && newinteriorid == 0)
{
  if(GetPlayerVirtualWorld(playerid) == 2)
	{
  	SetPlayerVirtualWorld(playerid,0);
  	//SetPlayerInterior(playerid,0);
  	SetPlayerPos(playerid,1933.4030,-1776.1339,13.3828);
  	SetPlayerFacingAngle(playerid,272.7751);
  	SetCameraBehindPlayer(playerid);
  	LeftTwoFourSeven[playerid] =2;
  	TimeToMoveTwoFourSeven[playerid] =3;
  	TogglePlayerControllable(playerid, 0);
  }
	}
	}
	return 1;
}
Reply
#6



pawn Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
  if(oldinteriorid == 3 && newinteriorid == 0)
  {
    if(GetPlayerVirtualWorld(playerid) == 1)
    {
      SetPlayerVirtualWorld(playerid,0);
      //SetPlayerInterior(playerid,0);
      SetPlayerPos(playerid,1877.6157,-1740.8281,13.4860);
      SetPlayerFacingAngle(playerid,187.0764);
      SetCameraBehindPlayer(playerid);
      LeftTwoFourSeven[playerid] =1;
      TimeToMoveTwoFourSeven[playerid] =3;
      TogglePlayerControllable(playerid, 0);
    }
  }//Closing brace wasn't here
  if(oldinteriorid == 4 && newinteriorid == 0)
  {
    if(GetPlayerVirtualWorld(playerid) == 2)
    {
      SetPlayerVirtualWorld(playerid,0);
      //SetPlayerInterior(playerid,0);
      SetPlayerPos(playerid,1933.4030,-1776.1339,13.3828);
      SetPlayerFacingAngle(playerid,272.7751);
      SetCameraBehindPlayer(playerid);
      LeftTwoFourSeven[playerid] =2;
      TimeToMoveTwoFourSeven[playerid] =3;
      TogglePlayerControllable(playerid, 0);
    }
  }
    //} This closing brace was supposed to be up there
  return 1;
}

Proper indentation can go a long way.
Reply
#7

Quote:
Originally Posted by Joe Staff


pawn Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
  if(oldinteriorid == 3 && newinteriorid == 0)
  {
    if(GetPlayerVirtualWorld(playerid) == 1)
    {
      SetPlayerVirtualWorld(playerid,0);
      //SetPlayerInterior(playerid,0);
      SetPlayerPos(playerid,1877.6157,-1740.8281,13.4860);
      SetPlayerFacingAngle(playerid,187.0764);
      SetCameraBehindPlayer(playerid);
      LeftTwoFourSeven[playerid] =1;
      TimeToMoveTwoFourSeven[playerid] =3;
      TogglePlayerControllable(playerid, 0);
    }
  }//Closing brace wasn't here
  if(oldinteriorid == 4 && newinteriorid == 0)
  {
    if(GetPlayerVirtualWorld(playerid) == 2)
    {
      SetPlayerVirtualWorld(playerid,0);
      //SetPlayerInterior(playerid,0);
      SetPlayerPos(playerid,1933.4030,-1776.1339,13.3828);
      SetPlayerFacingAngle(playerid,272.7751);
      SetCameraBehindPlayer(playerid);
      LeftTwoFourSeven[playerid] =2;
      TimeToMoveTwoFourSeven[playerid] =3;
      TogglePlayerControllable(playerid, 0);
    }
  }
    //} This closing brace was supposed to be up there
  return 1;
}

Proper indentation can go a long way.
ohh lol... Omg...Your avatar suits me lol.
Reply
#8

You cant tele players out of the yellow marker, afaik
Try it with freezing before teleportation
Or use a timer which calls the teleportion code after he exited the marker
Reply
#9

Quote:
Originally Posted by ♣ Joker ♠
You cant tele players out of the yellow marker, afaik
Try it with freezing before teleportation
Or use a timer which calls the teleportion code after he exited the marker
What are you talking about, it works?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)