AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Event for Player is not in Game (https://forums.alliedmods.net/showthread.php?t=162727)

sake 07-22-2011 07:31

Event for Player is not in Game
 
Hello there,

Is there an event or an function that enables me to check if a player is really playing or just has minimized the game or is in the Main Menu?

And while I'm here: Are there replacement methods for spawn(id) (Fun) or set_user_godmode(id,1) (Fun)?

kind regards

sake

Hunter-Digital 07-22-2011 17:55

Re: Event for Player is not in Game
 
I don't think it's possible do directly detect if the player minimized game or is in game menu but you can check if he moved/rotated or pressed a action in a certain time... that can determine if the player is afk.

Instead of spawn() (which is buggy) you could use ExecuteHam(Ham_CS_RoundRespawn, player) and instead of set_user_godmode() (which also seems buggy, dunno why) you can hook Ham_TakeDamage and check for "godmode" players and return HAM_SUPERCEDE if they are "gods"... but if set_user_godmode() works just fine you *should* use it since it's more efficient.

ConnorMcLeod 07-23-2011 04:34

Re: Event for Player is not in Game
 
Don't try to understand last post dude.

avril-lavigne 07-23-2011 06:25

Re: Event for Player is not in Game
 
He is trying to detect when <H> is pressed

Hunter-Digital 07-23-2011 06:44

Re: Event for Player is not in Game
 
Quote:

Originally Posted by avril-lavigne (Post 1516540)
He is trying to detect when <H> is pressed

Yep, *TRYING*, it's a poor method and it's slowhacking aswell, I for one have something else on H and I would be verry much pissed if I try to use it and that stupid commandmenu opens instead... so I think you understood, Dare Devil, your code is slowhacking and it's not "perfect" at all.

bibu 07-23-2011 06:50

Re: Event for Player is not in Game
 
Quote:

Originally Posted by Hunter-Digital (Post 1516290)
and instead of set_user_godmode() (which also seems buggy, dunno why)

Never had any problems with that native.

.Dare Devil. 07-23-2011 06:57

Re: Event for Player is not in Game
 
Quote:

Originally Posted by Hunter-Digital (Post 1516552)
Yep, *TRYING*, it's a poor method and it's slowhacking aswell, I for one have something else on H and I would be verry much pissed if I try to use it and that stupid commandmenu opens instead... so I think you understood, Dare Devil, your code is slowhacking and it's not "perfect" at all.

But there are no ohter way to do this i think.
I dont like slowhacking too but something we need it.

You can do this way too like when player connect then make menu and this menu will ask him this stuff.

So if he want a godmode when he is minimized then he just choose yes and then bind him this :)

sake 07-23-2011 09:30

Re: Event for Player is not in Game
 
Hmmm. What about trying to receive the "Esc" key command?

Hunter-Digital 07-23-2011 10:25

Re: Event for Player is not in Game
 
I dunno, I think you can hook "cancelselect" or some other command... do a debug on client_command() forward and see if it triggers something when you press escape but I doubt it.

Still, all those stuff won't actually be efficient on knowing if a player is afk, a player can be afk by actually leaving the keyboard and the game can be active... so the verry best way is to check for lack of input.

sake 07-23-2011 10:51

Re: Event for Player is not in Game
 
Hmmm. K.

Some other thing (what is the reason why I search for this): When I spawn a player that is not in the game the model appears and is stuck in the map. But the player is in Spectator Mode. How can I delete the old model?

Somehting like this, maybe?

engfunc(EngFunc_FreeEntPrivateData, id);

EDIT: I already know how to distinguish if the player is spawned correctly:

pev(id,pev_weapons) != 0


All times are GMT -4. The time now is 01:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.