SAMP Live Chat -
Mihaitza97 - 21.09.2014
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!
Re: SAMP Live Chat -
minhducc - 21.09.2014
Cool
Re: SAMP Live Chat -
Dangjai - 21.09.2014
Cool!
Re: SAMP Live Chat -
woot - 21.09.2014
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.
Re: SAMP Live Chat -
Mihaitza97 - 21.09.2014
Quote:
Originally Posted by woot
|
Okay.

I'll use this plugin in the next version.
Thanks.
Re: SAMP Live Chat -
Steel_ - 21.09.2014
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.
Re: SAMP Live Chat -
nGen.SoNNy - 21.09.2014
Nice release
Re: SAMP Live Chat -
Abagail - 21.09.2014
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.
Respuesta: SAMP Live Chat -
xDarkuzSx - 21.09.2014
where is the source code?
Re: Respuesta: SAMP Live Chat -
Mihaitza97 - 22.09.2014
Quote:
Originally Posted by xDarkuzSx
where is the source code?
|
You can download just source code. Please read again the topic...
Re: SAMP Live Chat -
KayJ - 22.09.2014
Nice