cp problem
#10

Quote:
Originally Posted by [D1zZy_vortex
]
hey guys ,

i have this in my script :

Код:
new cp1[MAX_PLAYERS];
new cp2[MAX_PLAYERS];



cp1[playerid] = SetPlayerCheckpoint(playerid, 1520.5525,-2604.5759,13.5469,3); 
cp2[playerid] = SetPlayerCheckpoint(playerid, 246.6656,65.0490,1003.6406,3);
i want just cp1 be active and cp2 be hidden,, when player enter cp1 ,cp2 will be shown and player pos be here : 246.4716,70.0103,1003.6406,357

and when player back and enter cp2 , cp2 must be hidden and player pos must be 1519.7589,-2597.4492,13.5469


please help and thnx
Well, the first thing someone should have said, is that SetPlayerCheckpoint does not ever return a value. So, you're basically just doing this:

pawn Код:
cp1 = 0;
cp2 = 0;
You only need one variable. Set it to true when they've entered the checkpoint, set it to false when they leave:

pawn Код:
new cp[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
  SetPlayerCheckpoint(playerid, 1520.5525,-2604.5759,13.5469,3);
  cp[playerid] = 0;
  return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
  if (cp[playerid])
  {
    cp[playerid] = 0;
    SetPlayerPos(playerid, 1519.7589,-2597.4492,13.5469);
    SetPlayerCheckpoint(playerid, 1520.5525,-2604.5759,13.5469,3);
    SendClientMessage(playerid, 0xFFFFFFFF, "Teleported!");
  }
  else
  {
    cp[playerid] = 1;
    SetPlayerPos(playerid, 246.4716,70.0103,1003.6406);
    SetPlayerCheckpoint(playerid, 246.6656,65.0490,1003.6406,3);
    SendClientMessage(playerid, 0xFFFFFFFF, "Teleported!");
  }
  return 1;
}
Tested it, and it looks like you mean to use an interior, too, seeing as I fell through the sky But, the correct checkpoint was there, and you get teleported to the right place.

Just add the interior like so:

pawn Код:
SetPlayerInterior(playerid, 5); // change the 5 to the correct interior id
And when they exit:

pawn Код:
SetPlayerInterior(playerid, 0);
EDIT: Oh, and don't use MAX_PLAYERS if you can help it.
Reply


Messages In This Thread
cp problem - by [D1zZy_vortex] - 05.03.2009, 17:42
Re: cp problem - by Dujma - 05.03.2009, 17:54
Re: cp problem - by [D1zZy_vortex] - 05.03.2009, 17:55
Re: cp problem - by [RP]Rav - 05.03.2009, 17:57
Re: cp problem - by Dujma - 05.03.2009, 17:57
Re: cp problem - by Lucas Giovanni - 05.03.2009, 17:57
Re: cp problem - by Dujma - 05.03.2009, 17:58
Re: cp problem - by Lucas Giovanni - 05.03.2009, 17:58
Re: cp problem - by [D1zZy_vortex] - 05.03.2009, 18:27
Re: cp problem - by 1337pr0 - 05.03.2009, 18:41

Forum Jump:


Users browsing this thread: 1 Guest(s)