Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define function%0(%1) forward%0(%1);public%0(%1)
- SetTimer("CheckforMessages_Console",10000,true); //Put this timer on OnGameModeInIt();
- function InsertText_Console(text[]) //You will use this function for the application chat. Example: In OnPlayerText(); or in a command like /n(ewbie) ...
- {
- mysql_real_escape_string(text,szString,g_Handle,256);
- format(szQueryInput,sizeof(szQueryInput), "INSERT INTO `chat_log` (Text) VALUES ('%s')", szString);
- mysql_function_query(g_Handle, szQueryInput, false, "", "");
- return 1;
- }
- function CheckforMessages_Console()
- {
- format(string, sizeof(string), "SELECT * FROM `chat_log` WHERE `Status` = 1");
- mysql_function_query(g_Handle, string, true, "CheckMessage", "");
- return 1;
- }
- function CheckMessage() //This function will show on server, messages who was sent from console.
- {
- new rows,fields,temp[128],Message[200];
- cache_get_data(rows,fields);
- if(rows) {
- cache_get_row(0, 1, temp), format(Message,sizeof(temp),temp);
- printf("%s",Message); //You can hide this.
- SendClientMessageToAll(COLOR_WARNING,Message); //You can show the Message in another form.
- mysql_format(g_Handle,string,sizeof(string),"UPDATE `chat_log` SET `Status` = 0 WHERE `Text`= '%s'",Message);
- mysql_function_query(g_Handle,string,false,"","");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment