AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Please fix ugly bug. (https://forums.alliedmods.net/showthread.php?t=170991)

Evaldas.Grigas 10-31-2011 06:19

Please fix ugly bug.
 
This code:
PHP Code:

public handle_say(id
{
    new 
said[192]
    
read_args(said,192)
    if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        if( ( 
containi(said"who") != -&& containi(said"admin") != -) || contain(said"/vips") != -)
        
set_task(0.1,"print_adminlist",id)
    }
    return 
PLUGIN_CONTINUE


Has an ugly bug:
[IMG]http://img408.**************/img408/2045/unledya.png[/IMG]
And people somethimes writes: /vips who su** d***

Xellath 10-31-2011 06:29

Re: Please fix ugly bug.
 
Isn't it quite obvious? You're checking if the string CONTAINS /vips not checking if first 5 letters/the whole string is EQUAL to /vips. Thus allowing people to write /vipsthatsuckd***s.

Evaldas.Grigas 10-31-2011 06:31

Re: Please fix ugly bug.
 
How to fix that? Its not mine code :)

liinuus 10-31-2011 06:35

Re: Please fix ugly bug.
 
use the equal() instead of contain()

Evaldas.Grigas 10-31-2011 06:39

Re: Please fix ugly bug.
 
Like this?
PHP Code:

public handle_say(id
{
    new 
said[192]
    
read_args(said,192)
    if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        if( ( 
equal(said"who") != -&& equal(said"admin") != -) || equal(said"/vips") != -)
        
set_task(0.1,"print_adminlist",id)
    }
    return 
PLUGIN_CONTINUE


Now even when I write /vipmenu it shows vips online...

Xellath 10-31-2011 06:41

Re: Please fix ugly bug.
 
Note that just registering the command to 'say /vips' would be more efficient than hooking 'say' and retrieving the string to check if it's equal to something.

Evaldas.Grigas 10-31-2011 06:44

Re: Please fix ugly bug.
 
Fixed. Thank you Xellath!

fysiks 10-31-2011 19:33

Re: Please fix ugly bug.
 
Quote:

Originally Posted by Evaldas.Grigas (Post 1587031)
Please fix ugly bug.

Sorry, we can't fix ugly. You will just have to live with it.


All times are GMT -4. The time now is 14:25.

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