Checkpoint Command, Freeze + Unfreeze
#3

It would be better if you use a player variable + OnPlayerKeyStateChange, for example:

pawn Код:
// On top:
new IsInCheckPoint[MAX_PLAYERS];

// At OnPlayerEnterCheckpoint (case 24)
IsInCheckPoint[playerid] = 1; // 1 will mean in this case the entered checkpoint 24

// OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if(IsInCheckPoint[playerid] == 1) // check if the player is in checkpoint 24
  {
    if(newkeys & 1024) // check if they pressed ALT
    {
      TogglePlayerControllable(playerid, true); // unfreeze the player
      IsInCheckPoint[playerid] = 0; // set this variable back to 0 so when you press ALT unfreezing wont be toggled again
      return 1;
    }
  }
  return 1;
}
For a list of keys check https://sampwiki.blast.hk/wiki/GetPlayerKeys#Key_List you will have to change the 1024 to the key you want.
I hope this helped you
Reply


Messages In This Thread
Checkpoint Command, Freeze + Unfreeze - by 6tynine - 06.07.2009, 14:40
Re: Checkpoint Command, Freeze + Unfreeze - by 6tynine - 06.07.2009, 15:51
Re: Checkpoint Command, Freeze + Unfreeze - by -Sneaky- - 06.07.2009, 16:14
Re: Checkpoint Command, Freeze + Unfreeze - by ByFukara - 06.07.2009, 16:16
Re: Checkpoint Command, Freeze + Unfreeze - by 6tynine - 06.07.2009, 16:27

Forum Jump:


Users browsing this thread: 2 Guest(s)