Raised This Month: $51 Target: $400
 12% 

Variable + Afk


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-12-2017 , 22:01   Variable + Afk
Reply With Quote #1

Hey guys i didnt want to make 2 topics so ill just ask 2 questions here if thats ok.

1.
Code:
ColorChat( 0, RED, "");

Can i make a variable i can use instead of RED in this case, i tried some things but i didn't succeed.
Example:
Code:
COLOR=RED  ColorChat( 0, COLOR, "");


2. What is the best way to detect an afk ( while somewhat still simple, for a newbie like me )

Thanks in advance
maqi is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-13-2017 , 02:09   Re: Variable + Afk
Reply With Quote #2

for 1, look at client_print_color, a function added in 1.8.3
here you can use yellow, green and either team color or any of grey / red / blue (but not multiple ones in the same sentence)
it does it by faking the team of a client for a moment while showing the message

for no 2, one way (that I use) is to mark all clients as g_hasmoved[id] = false at spawn
then
Code:
const ButtonBits = ( IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP); register_forward(FM_CmdStart , "fw_FMCmdStart"); public fw_FMCmdStart( id , handle , seed )     if ( get_uc( handle , UC_Buttons ) & ButtonBits )         g_hasmoved[id] = true;

this will only mark player as not afk once one of those keys has been pressed (wasd or space)
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-13-2017 , 05:56   Re: Variable + Afk
Reply With Quote #3

Quote:
Originally Posted by aron9forever View Post
for 1, look at client_print_color, a function added in 1.8.3
here you can use yellow, green and either team color or any of grey / red / blue (but not multiple ones in the same sentence)
it does it by faking the team of a client for a moment while showing the message

for no 2, one way (that I use) is to mark all clients as g_hasmoved[id] = false at spawn
then
Code:
const ButtonBits = ( IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP); register_forward(FM_CmdStart , "fw_FMCmdStart"); public fw_FMCmdStart( id , handle , seed )     if ( get_uc( handle , UC_Buttons ) & ButtonBits )         g_hasmoved[id] = true;

this will only mark player as not afk once one of those keys has been pressed (wasd or space)
Checking each second seems much better than doing it per frame. Do you really need such precision for an afk manager plugin?
__________________
HamletEagle is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-13-2017 , 08:27   Re: Variable + Afk
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
Checking each second seems much better than doing it per frame. Do you really need such precision for an afk manager plugin?
I need precision in my particular scenario as it is possible to miss <1s key states because of lag, and it's a jailbreak server where usually players are forced to stop moving very early in the round (before the afk slaying is done) so I can't afford to miss any key press

I forgot to mention however that the forward must be unregistered after the afk state of all players is checked (like 30 seconds into the round or something) and then registered again at new round

If you know any better failproof solution, please post it
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-13-2017 , 09:02   Re: Variable + Afk
Reply With Quote #5

I appear to be using amxx 1.4 something O.o How is that even possible i downloaded it this year.

Is that method server heavy ? I dont really need that much precision its for a deathrun server mostly.

Also is it possible to detect it again, once they have moved from the spawn ?

Last edited by maqi; 11-13-2017 at 09:12.
maqi is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-13-2017 , 12:22   Re: Variable + Afk
Reply With Quote #6

1.4?!!!!?!!? That version doesn't even exist in the official download site. If you're talking about AMXX Studio's version, that has nothing with AMXX's version itself.

For the color, you can do new Color:iColor = RED. If you aren't using AMXX 1.8.3, I suggest you switch to a better colorchat stock, you can use mine for example.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-13-2017 , 14:54   Re: Variable + Afk
Reply With Quote #7

Yeap its the studio, 1.6 is the amxmodx. I really dont think i should be switching at the mmoment because im still learning but thank you.

Anyone else has a good method of detecting afk if the one above isnt good for some reason?
maqi is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-13-2017 , 15:02   Re: Variable + Afk
Reply With Quote #8

You're very late... already there is the 1.8.2 version, and the most recent is the 1.8.3...

Why are you still using that "turtle" version?
CrazY. is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-13-2017 , 15:21   Re: Variable + Afk
Reply With Quote #9

Quote:
Originally Posted by maqi View Post
1.6 is the amxmodx. I really dont think i should be switching at the mmoment because im still learning but thank you.
If you really are running AMXX 1.6 (and I doubt it, I think you've mistaken something), then you should definitely switch. That version is like 12 years old.
klippy is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-13-2017 , 15:26   Re: Variable + Afk
Reply With Quote #10

Ok no problem ill switch it up I dont know how tho ahahhaha, i literraly downloaded it this year xD
maqi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:34.


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