SA-MP Forums Archive
BRB..pausing.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: BRB..pausing.. (/showthread.php?tid=177863)



BRB..pausing.. - Face9000 - 19.09.2010

Someone know how to put the text "BRB ... pausing" under the playername when he press ESC?


Re: BRB..pausing.. - Memoryz - 19.09.2010

There isn't a way to detect when a player presses the ESC key.


Re: BRB..pausing.. - WillyP - 19.09.2010

Quote:
Originally Posted by Memoryz
View Post
There isn't a way to detect when a player presses the ESC key.
getplayertickcount

This forum requires that you wait 120 seconds between posts. Please try again in 23 seconds.
OMGWTFBBQ


Re: BRB..pausing.. - Face9000 - 19.09.2010

mmm..so..what i need to do? :P

1. This forum requires that you wait 120 seconds between posts. Please try again in 74 seconds.
1. This forum requires that you wait 120 seconds between posts. Please try again in 64 seconds.
1. This forum requires that you wait 120 seconds between posts. Please try again in 44 seconds.
1. This forum requires that you wait 120 seconds between posts. Please try again in 21 seconds.
1. This forum requires that you wait 120 seconds between posts. Please try again in 5 seconds.


Anti spam nub.


Re: BRB..pausing.. - WillyP - 19.09.2010

i think theres a fs somewhere, but i aint gunna search it cause im doing some scripts myself atm


Re: BRB..pausing.. - Conroy - 19.09.2010

OnPlayerUpdate isn't called.

Find out how many times OnPlayerUpdate is called (32 per second approx.), then create a timer to zero a variable which is increased everytime OnPlayerUpdate is called.

Ex:

pawn Code:
forward CheckForPause();

new PlayerUpdateCount[MAX_PLAYERS];
new PlayerPaused[MAX_PLAYERS];

//OnGameModeInit
SetTimer("CheckForPause", 1000, true);

//OnPlayerUpdate
PlayerUpdateCount[playerid] += 0.03125
//Because 0.03125 * the amount of times OnPlayerUpdate is called (32) equals 1

public CheckForPause()
{
    for(new i; i <= MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) && !PlayerPaused[i]) {
            PlayerUpdateCount[i]--;
            if(PlayerUpdateCount[i] < 0) PlayerPaused[i] = 1;
        }
    }
    return 1;
}



Re: BRB..pausing.. - Face9000 - 19.09.2010

mmm k i will try!


Re: BRB..pausing.. - Conroy - 19.09.2010

Make sure you check how many times OnPlayerUpdate is called though, 32 is a number I've heard a few people say around the forums.


Re: BRB..pausing.. - The_Moddler - 19.09.2010

Quote:
Originally Posted by Conroy
View Post
OnPlayerUpdate isn't called.

Find out how many times OnPlayerUpdate is called (32 per second approx.), then create a timer to zero a variable which is increased everytime OnPlayerUpdate is called.

Ex:

pawn Code:
forward CheckForPause();

new PlayerUpdateCount[MAX_PLAYERS];
new PlayerPaused[MAX_PLAYERS];

//OnGameModeInit
SetTimer("CheckForPause", 1000, true);

//OnPlayerUpdate
PlayerUpdateCount[playerid] += 0.03125
//Because 0.03125 * the amount of times OnPlayerUpdate is called (32) equals 1

public CheckForPause()
{
    for(new i; i <= MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) && !PlayerPaused[i]) {
            PlayerUpdateCount[i]--;
            if(PlayerUpdateCount[i] < 0) PlayerPaused[i] = 1;
        }
    }
    return 1;
}
Why this doesn't work for me?


Re: BRB..pausing.. - Conroy - 19.09.2010

Like I said, 32 may not be the amount of times OnPlayerUpdate is called. I've never done it better, all I know is that is how my friend done it. Check how many times OnPlayerUpdate is called and use 1 / number of times it is called in OnPlayerUpdate.