Button ESC
#1

I want to know how to do so when you tighten ESC in the game show "Pause" as in partyserver.

In the list of keys of samp ESC button does not appear, then I want to know another way to do it.

I am using a translator.
Reply
#2

The ESC button cannot be detected with a press.

There are other ways to detect when a player has paused.
Reply
#3

pawn Код:
new
 PausedTimer;

public OnGameModeInit() {
  PausedTimer = SetTimer("CheckPaused", 1000, 1);
  return 1;
}

forward CheckPaused();
public CheckPaused() {
  for(new o = 0; o < GetMaxPlayers(); o++ ){
    if(GetPVarInt(o, "Paused") == 0) {
     // The player is paused / Pressed ESC.
    }
  }
  return 1;
}

public OnPlayerConnect(playerid) {
  SetPVarInt(playerid, "Paused", 0);
  return 1;
}

public OnPlayerUpdate(playerid) {
  SetPVarInt(playerid, "Paused", 1);
  return 1;
}
Reply
#4

Quote:
Originally Posted by Carlton
pawn Код:
new
 PausedTimer;

public OnGameModeInit() {
  PausedTimer = SetTimer("CheckPaused", 1000, 1);
  return 1;
}

forward CheckPaused();
public CheckPaused() {
  for(new o = 0; o < GetMaxPlayers(); o++ ){
    if(GetPVarInt(o, "Paused") == 0) {
     // The player is paused / Pressed ESC.
    }
  }
  return 1;
}

public OnPlayerConnect(playerid) {
  SetPVarInt(playerid, "Paused", 0);
  return 1;
}

public OnPlayerUpdate(playerid) {
  SetPVarInt(playerid, "Paused", 1);
  return 1;
}
OnPlayerUpdate is NOT called for paused players..

So why are you setting them as paused there?
Reply
#5

Quote:
Originally Posted by TheInnocentOne
Quote:
Originally Posted by Carlton
pawn Код:
new
 PausedTimer;

public OnGameModeInit() {
  PausedTimer = SetTimer("CheckPaused", 1000, 1);
  return 1;
}

forward CheckPaused();
public CheckPaused() {
 for(new o = 0; o < GetMaxPlayers(); o++ ){
   if(GetPVarInt(o, "Paused") == 0) {
     // The player is paused / Pressed ESC.
   }
 }
 return 1;
}

public OnPlayerConnect(playerid) {
  SetPVarInt(playerid, "Paused", 0);
  return 1;
}

public OnPlayerUpdate(playerid) {
  SetPVarInt(playerid, "Paused", 1);
  return 1;
}
OnPlayerUpdate is NOT called for paused players..

So why are you setting them as paused there?
One: http://forum.sa-mp.com/index.php?topic=115828.0
Two: I never said it's called for paused players.
Three: I set them there because I wanted to, and that's the only way to find if someone ALT-Tabed or Pressed ESC.
Reply
#6

Quote:
Originally Posted by Carlton
pawn Код:
new
 PausedTimer;

public OnGameModeInit() {
  PausedTimer = SetTimer("CheckPaused", 1000, 1);
  return 1;
}

forward CheckPaused();
public CheckPaused() {
 for(new o = 0; o < GetMaxPlayers(); o++ ){
   if(GetPVarInt(o, "Paused") == 0) {
     // The player is paused / Pressed ESC.
   }
 }
 return 1;
}

public OnPlayerConnect(playerid) {
  SetPVarInt(playerid, "Paused", 0);
  return 1;
}

public OnPlayerUpdate(playerid) {
  SetPVarInt(playerid, "Paused", 1);
  return 1;
}
I have 3 errors:

error 017: undefined symbol "SetPVarInt"
error 017: undefined symbol "GetPVarInt"
error 017: undefined symbol "SetPVarInt"
warning 204: symbol is assigned a value that is never used: "PausedTimer"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#7

You don't have the latest server package with the 0.3 includes.

Download them: http://files.sa-mp.com/samp03asvr_R7_win32.zip
Reply
#8

Quote:
Originally Posted by _0wn3r_
Quote:
Originally Posted by Carlton
pawn Код:
new
 PausedTimer;

public OnGameModeInit() {
  PausedTimer = SetTimer("CheckPaused", 1000, 1);
  return 1;
}

forward CheckPaused();
public CheckPaused() {
  for(new o = 0; o < GetMaxPlayers(); o++ ){
    if(GetPVarInt(o, "Paused") == 0) {
     // The player is paused / Pressed ESC.
    }
  }
  return 1;
}

public OnPlayerConnect(playerid) {
  SetPVarInt(playerid, "Paused", 0);
  return 1;
}

public OnPlayerUpdate(playerid) {
  SetPVarInt(playerid, "Paused", 1);
  return 1;
}
I have 3 errors:

error 017: undefined symbol "SetPVarInt"
error 017: undefined symbol "GetPVarInt"
error 017: undefined symbol "SetPVarInt"
warning 204: symbol is assigned a value that is never used: "PausedTimer"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Update your scripting package (www.sa-mp.com). Oh, and add this:

pawn Код:
public OnGameModeExit() {
  KillTimer(PausedTimer);
  return 1;
}
Reply
#9

@Carlton,
Oh my god, what a fail.

@_0wn3r_ ,
Check ******' YUP for proper detection of paused players.
Reply
#10

Quote:
Originally Posted by $ЂЯĢ
@Carlton,
Oh my god, what a fail.

@_0wn3r_ ,
Check ******' YUP for proper detection of paused players.
The OnPlayerUpdate use still does work, but not the best way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)