[Tool/Web/Other] SAMP Live Chat
#1

SAMP Live Chat
Introduction
With this program you can send a message to your server, and everyone who are online will see the message.

How it works:
Below i'll post a PAWN Code for your server. This will include few lines: SELECT/UPDATE/INSERT functions, an timer(who will check the table every time after 10 seconds), 3 functions and two global strings.

What you must to know:
Now 4-5 days, i posted this program, but after 2-3 hours the topic was deleted for unknown reason. I guess the reason was "with this program he stole database information from users", so, now i will post source code only, and with that, you can check what you want.
Without the PAWN Code in your server, this will never work fine.
PAWN Code is created with last MySQL version. You can downgrade all mysql query to your version with no problem.
When you connect this program to a database, will automatically create table `chat_log`, don't create manually the table!

Screenshots:




PAWN Code:
pawn Code:
new szQueryInput[512]; // If you want to save memory.
new szString[230];

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;
}
If you don't have defined function, copy this in your gamemode:
pawn Code:
#define         function%0(%1)      forward%0(%1);public%0(%1)
DOWNLOAD:
#1 Direct Link. Password is: sampchatsource .
#VirusTotal Result: Click here.

# If this topic will be deleted again, can the moderator send the reason via PM? Because i created one message to all staff, and one to a moderator who was online, and no-one responds.
# If you find problems about this program, leave a message here!
# I'm waiting your opinion/question!
Reply
#2

Cool
Reply
#3

Cool!
Reply
#4

You might wanna check out the Socket plugin (https://sampforum.blast.hk/showthread.php?tid=333934) for a next version - that would make this much faster in terms of syncing messages and performance.
Reply
#5

Quote:
Originally Posted by woot
View Post
You might wanna check out the Socket plugin (https://sampforum.blast.hk/showthread.php?tid=333934) for a next version - that would make this much faster in terms of syncing messages and performance.
Okay.
I'll use this plugin in the next version.

Thanks.
Reply
#6

Quote:
# If this topic will be deleted again, can the moderator send the reason via PM? Because i created one message to all staff, and one to a moderator who was online, and no-one responds.

It probably got deleted because you did not include the source code, or a moderator does not think this program is appropriate.
Reply
#7

Nice release
Reply
#8

I see how MySQL can be an easy way to do this without the usage of plug-ins, how-ever this program would be much more dependable if it used the socket plug-in.
Reply
#9

where is the source code?
Reply
#10

Quote:
Originally Posted by xDarkuzSx
View Post
where is the source code?
You can download just source code. Please read again the topic...
Reply
#11

Nice
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)