|
Senior Member
Join Date: Jan 2009
Location: BRASIL
|
03-13-2023
, 09:23
Re: say number motd number
|
#13
|
Quote:
Originally Posted by fysiks
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(1, text, charsmax(text))
if( equal(text, "top", 3) )
{
new iValue = str_to_num(text[3])
if( iValue > 0 )
{
show_motd(id, fmt("%s%d", WEB_URL, iValue), 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
__________________
|
|
|
|