View Single Post
rx1983
Senior Member
Join Date: Jan 2009
Location: BRASIL
Old 03-13-2023 , 09:23   Re: say number motd number
Reply With Quote #13

Quote:
Originally Posted by fysiks View Post
You are doing way more formatting than you need to do, no formatting related to "text" is required. Should also validate the number before showing the MOTD. Also, returning PLUGIN_HANDLED unconditionally in a "say" hook will prevent all normal chat messages from showing.

PHP Code:
#include <amxmodx>

#define WEB_URL "https://google.com/search?q="

public plugin_init()
{
    
register_clcmd("say""hook_say")
}

public 
hook_say(id)
{
    new 
text[8]
    
read_argv(1textcharsmax(text))

    if( 
equal(text"top"3) )
    {
        new 
iValue str_to_num(text[3])
        if( 
iValue )
        {
            
show_motd(idfmt("%s%d"WEB_URLiValue), fmt("Top %d | %s"iValue__DATE__))
        }
        return 
PLUGIN_HANDLED
    
}

.sma(20) : error 017: undefined symbol "fmt"
.sma(24) : warning 209: function "hook_say" should return a value
__________________
rx1983 is offline
Send a message via MSN to rx1983