Code:
#include <amxmodx>
#include <http2>
#include <ColorChat>
#pragma semicolon 1
new const Version[] = "0.1";
new buffer[HTTP2_BUFFER_SIZE];
new g_Name[32];
public plugin_init() {
register_plugin("Clever Bot", Version, "Freezo");
register_clcmd("say", "hook_Say");
register_clcmd("say_team", "hook_Say");
}
public hook_Say(id) {
new _argGet[212];
read_args(_argGet, charsmax(_argGet));
remove_quotes(_argGet);
if(_argGet[0] == 0)
return PLUGIN_HANDLED;
get_user_name(id , g_Name, charsmax(g_Name));
new urlSet[128];
formatex(urlSet, charsmax(urlSet), "http://spawner-best.esy.es/test.php?text=%s", _argGet);
HTTP2_Download(urlSet, _, _, "ProcessDl");
return PLUGIN_CONTINUE;
}
public ProcessDl(id) {
new iLen;
HTTP2_getData(buffer, charsmax(buffer), iLen);
new const szPub[][] = { "Clevermessage" , "app" , "chat" , "Android" , "IOS" };
new const szRand[][] = { "Oo What?" , "Shut up man, wait !!" , "please i come here to play !" , ":(" , "Wait..." };
for(new i = 0;i < sizeof( szPub ); i++){
if(containi(buffer, szPub[i]) != -1){
ColorChat( 0 , TEAM_COLOR , "^4[Clever Bot] ^3Freezo ^1: ^4%s?",szRand[random_num(0,5)]);
return PLUGIN_HANDLED;
}
}
new szText[64];
formatex(szText, charsmax(szText), "Hello %s!", g_Name);
replace(buffer, charsmax(buffer) , "Hello", szText);
replace(buffer, charsmax(buffer) , "Hi", szText);
ColorChat( 0 , TEAM_COLOR , "^4[Clever Bot] ^3Freezo ^1: ^4%s",buffer);
return PLUGIN_HANDLED;
}