Afk-Time over Head please. -
imagician - 22.09.2011
Hi guys.
Can you please help me to implement?
I would like to see if a player on the desktop or the menu is that on this player is over head afk since %d seconds and when he comes back into play, it is dropped on his head.
Sincerely, Imagician.
Re: Afk-Time over Head please. -
Kingunit - 22.09.2011
Do you know how to work with Create3DTextLabel? Then you can attach it.
Re: Afk-Time over Head please. -
imagician - 22.09.2011
Could you please do that for me?
I have tried several things, it does not work.
Re: Afk-Time over Head please. -
Zonoya - 22.09.2011
u need some skills to make something like that post ur /afk command please and ill see if i can help you
Re: Afk-Time over Head please. -
imagician - 22.09.2011
This has nothing to do with the command /afk.
If the player goes into the Menu (ESC) or on the desktop, then let him get over his head (since player is %d seconds in the menu or the desktop).
Re: Afk-Time over Head please. -
Zonoya - 22.09.2011
hmm let me see what i can do xD
Re: Afk-Time over Head please. -
imagician - 22.09.2011
Help please..
Re: Afk-Time over Head please. -
Zonoya - 22.09.2011
hmm i dont see how i can make this im not that good at Scripting even tho i can make a good server xD so sorry im out xD
Re: Afk-Time over Head please. -
Kingunit - 22.09.2011
I will drop a short example:
Ontop:
pawn Код:
#define FPS_CHECKS 4
new Text3D:PauseLabel[MAX_PLAYERS];
new PlayerFPS[MAX_PLAYERS][FPS_CHECKS];
new Paused[MAX_PLAYERS];
new PausedTimer;
forward PauseCheck();
forward PlayerHasPaused(playerid);
forward PlayerHasUnpaused(playerid);
forward IsPlayerPaused(playerid);
OnGameModeInit
pawn Код:
PausedTimer = SetTimer("PauseCheck", 1000, 1);
OnGameModeExit
OnPlayerDisconnect
pawn Код:
Delete3DTextLabel(PauseLabel[playerid]);
Bottom of your script
pawn Код:
public PlayerHasPaused(playerid)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerRame(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[%d] %s is paused.", playerid, sendername);
PauseLabel[playerid] = Create3DTextLabel(string,0xDE8900FF,0,0,0,50,-1,1);
Attach3DTextLabelToPlayer(PauseLabel[playerid], playerid, 0,0,0);
return 1;
}
public PlayerHasUnpaused(playerid)
{
Delete3DTextLabel(PauseLabel[playerid]);
return 1;
}
public IsPlayerPaused(playerid) return Paused[playerid];
public PauseCheck()
{
new ps;
for(new id=0; id < MAX_PLAYERS; id++)
{
if(!IsPlayerConnected(id)) continue;
ps = GetPlayerState(id);
if(ps != PLAYER_STATE_ONFOOT && ps != PLAYER_STATE_DRIVER && ps != PLAYER_STATE_PASSENGER) continue;
for(new x = FPS_CHECKS-1; x > 0; x--)
{
PlayerFPS[id][x] = PlayerFPS[id][x - 1];
}
PlayerFPS[id][0] = GetPlayerDrunkLevel(id);
for(new x = 0; x < FPS_CHECKS; x++)
{
if(x == FPS_CHECKS - 1)
{
if(Paused[id] != 1) PlayerHasPaused(id);
Paused[id] = 1;
break;
}
if(PlayerFPS[id][x] == PlayerFPS[id][x + 1]) continue;
if(Paused[id] != 0) PlayerHasUnpaused(id);
Paused[id] = 0;
break;
}
if(PlayerFPS[id][0] < 100)
{
SetPlayerDrunkLevel(id, 2000);
}
}
return 1;
}
Post your result.
Re: Afk-Time over Head please. -
imagician - 22.09.2011
Whats with the seconds and your code is too much? or not?