How to prevent using commands/words?

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Harley
Forum Regular
Posts: 344
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

How to prevent using commands/words?

Post by Harley » Fri May 10, 2019 4:57 am

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

Yukiko
Distro Developer
Posts: 2631
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: How to prevent using commands/words?

Post by Yukiko » 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.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

Harley
Forum Regular
Posts: 344
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: How to prevent using commands/words?

Post by Harley » Fri May 10, 2019 1:48 pm

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?

Yukiko
Distro Developer
Posts: 2631
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: How to prevent using commands/words?

Post by Yukiko » Fri May 10, 2019 2:57 pm

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.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

Skinny
Expert Poster
Posts: 72
Joined: Wed Dec 19, 2012 10:27 pm

Re: How to prevent using commands/words?

Post by Skinny » Fri May 10, 2019 5:52 pm

You can use the 0xAD packet hook.

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

Yukiko
Distro Developer
Posts: 2631
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: How to prevent using commands/words?

Post by Yukiko » 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. :)
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

RusseL
Forum Regular
Posts: 356
Joined: Fri Feb 20, 2009 8:30 pm

Re: How to prevent using commands/words?

Post by RusseL » Sat May 11, 2019 6:18 am

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

Harley
Forum Regular
Posts: 344
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: How to prevent using commands/words?

Post by Harley » 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!

RusseL
Forum Regular
Posts: 356
Joined: Fri Feb 20, 2009 8:30 pm

Re: How to prevent using commands/words?

Post by RusseL » Sat May 11, 2019 2:56 pm

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

Skinny
Expert Poster
Posts: 72
Joined: Wed Dec 19, 2012 10:27 pm

Re: How to prevent using commands/words?

Post by Skinny » Sat May 11, 2019 4:33 pm

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

Turley
POL Developer
Posts: 653
Joined: Sun Feb 05, 2006 4:45 am

Re: How to prevent using commands/words?

Post by Turley » Sun May 12, 2019 12:08 am

CChr(text["shit"]) makes no sense ;)
if (text.find("shit")) is an better option.

Harley
Forum Regular
Posts: 344
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: How to prevent using commands/words?

Post by Harley » Thu May 16, 2019 4:24 pm

Thank you guys! It works! :deadhorse:

Post Reply