Page 1 of 1

How to prevent using commands/words?

Posted: Fri May 10, 2019 4:57 am
by Harley
Is there some function or method, how to prevent use commands or some words?

Example: player type word, if this word in my database, server have to prevent and block it, before it will send

Re: How to prevent using commands/words?

Posted: Fri May 10, 2019 8:01 am
by Yukiko
All commands must be prefixed with a period. Also, commands have a hierarchy so that players cannot use a command that is intended for staff. In the Distro in /pkg /commands you will find the folders that contain the commands sorted according to the command level that can use them.

Re: How to prevent using commands/words?

Posted: Fri May 10, 2019 1:48 pm
by Harley
Yukiko wrote:
Fri May 10, 2019 8:01 am
All commands must be prefixed with a period. Also, commands have a hierarchy so that players cannot use a command that is intended for staff. In the Distro in /pkg /commands you will find the folders that contain the commands sorted according to the command level that can use them.
Yukiko, my friend, I understand and know it. I asked about other thing.
How to prevent staff use some command after he type it and send from client?
And analogue, how to prevent player type some words after he send from client?

Re: How to prevent using commands/words?

Posted: Fri May 10, 2019 2:57 pm
by Yukiko
Oh. I think I understand.
You want a word filter to stop certain words from being used, for example you want to prevent players or staff from sending the words "damn" or "hell".

If that is what you wish to do, you can use the speech packet hook to provide a filter. I don't know how that might affect performance.

Re: How to prevent using commands/words?

Posted: Fri May 10, 2019 5:52 pm
by Skinny
You can use the 0xAD packet hook.

We use it on the server and we don't have performance problems.

Re: How to prevent using commands/words?

Posted: Fri May 10, 2019 10:35 pm
by Yukiko
Thank you Skinny. Both for the direction to the packet and for the report about performance. I have been curious about how bad, if any, the performance hit might be. :)

Re: How to prevent using commands/words?

Posted: Sat May 11, 2019 6:18 am
by RusseL
I used this hook to log all player messages, and to prevent in-game flooding if message repeats. It works pretty good, had 100-150 online.
But, i used old svn 099 core version on my server, and after 20-25 days uptime hook always stopped working. I don't know why, never tried to search, just did a restart every 15 days. It could be some kind of overflow, maybe

Re: How to prevent using commands/words?

Posted: Sat May 11, 2019 2:09 pm
by Harley
Thank you guys!
I use this hook also and log all commands from staff after ".".
But at final, I dont understand how to prevent chars msgs after they press Enter?)
Maybe someone of you can show an example or share some code?

With best regards!

Re: How to prevent using commands/words?

Posted: Sat May 11, 2019 2:56 pm
by RusseL
Harley wrote:
Sat May 11, 2019 2:09 pm
Thank you guys!
I use this hook also and log all commands from staff after ".".
But at final, I dont understand how to prevent chars msgs after they press Enter?)
Maybe someone of you can show an example or share some code?

With best regards!
It depends on return value of your hook.
0 - send packet to pol-core/client after your hook is done
1 - drop packet

Take a look here https://github.com/polserver/polserver/ ... s.txt#L450
there is exactly what you need explained on speechhook example :D

Re: How to prevent using commands/words?

Posted: Sat May 11, 2019 4:33 pm
by Skinny
Yukiko wrote:
Fri May 10, 2019 10:35 pm
Thank you Skinny. Both for the direction to the packet and for the report about performance. I have been curious about how bad, if any, the performance hit might be. :)
It works good here. In January we had 900 online. POL100 version.
Harley wrote:
Sat May 11, 2019 2:09 pm
Thank you guys!
I use this hook also and log all commands from staff after ".".
But at final, I dont understand how to prevent chars msgs after they press Enter?)
Maybe someone of you can show an example or share some code?

With best regards!
inside hook script:

Code: Select all

if(CChr(text["shit"]))
	print("bad word");
	return 1; //drop text.
else
	return 0; //ok, send text to pol-core/client.
endif

Re: How to prevent using commands/words?

Posted: Sun May 12, 2019 12:08 am
by Turley
CChr(text["shit"]) makes no sense ;)
if (text.find("shit")) is an better option.

Re: How to prevent using commands/words?

Posted: Thu May 16, 2019 4:24 pm
by Harley
Thank you guys! It works! :deadhorse: