How to prevent using commands/words?
Moderator: POL Developer
How to prevent using commands/words?
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
Example: player type word, if this word in my database, server have to prevent and block it, before it will send
-
- Distro Developer
- Posts: 2824
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: How to prevent using commands/words?
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?
Yukiko, my friend, I understand and know it. I asked about other thing.Yukiko wrote: ↑Fri May 10, 2019 8:01 amAll 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.
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?
-
- Distro Developer
- Posts: 2824
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: How to prevent using commands/words?
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.
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.
-
- Distro Developer
- Posts: 2824
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: How to prevent using commands/words?
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?
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
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?
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!
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?
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

Re: How to prevent using commands/words?
It works good here. In January we had 900 online. POL100 version.
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?
CChr(text["shit"]) makes no sense 
if (text.find("shit")) is an better option.

if (text.find("shit")) is an better option.
Re: How to prevent using commands/words?
Thank you guys! It works! 
