PDA

View Full Version : Another request(huge one)


gamemann
01-13-2012, 22:57
Hello all,
I been trying to work on a plugin for this for quite a while.
It is possible since i thought of it in my head and it seems pretty possible, just i am not good enough to handle it.
Let me tell you the request.

Here is what happens since it's hard to explain:
- When someone types in the chatbox, it sends the info(name and message) to sql database(easy).
- Then prints it on a php web page(basically like chat history).
Now this is the part that would make it pretty cool:
- On that web page where the chat history is printed, there is 2 text fields, name and message, when you type it in and hit submit, it prints that to the sql database and then quickly sends it to the server chatbox(probably super hard but a good coder could do it).
It would be pretty cool. The page would have auto refresh every 5 seconds so basically it's like you can use the server's chatbox on a web page. Would be awesome for support and stuff.
I hope one of you guys make it!
Please tell me if you don't understand!
Thanks,
Gamemann

McFlurry
01-13-2012, 23:05
Everything sounds pretty easy up until the part about the MySQL database telling sourcemod it has changed its tables. I don't know of any way that sourcemod can detect a MySQL change, other than grabbing new results every few seconds and printing them out in their timed interval.

TnTSCS
01-13-2012, 23:06
so, you got the first half done where someone types in chat and it posts it to the php web page?

I'm thinking you could have the php post the message with a certain flag in the table row and have the plugin scan the sql server for all records with that flag, then when it finds it, it posts it to the chat in game and flags that record as sent so it doesn't find it again when the query is executed next go around.

TnTSCS
01-13-2012, 23:09
PHP to Sourcemod example:

RowID, name, message, flag

"1","TnTSCS","testing this message","N"

sourcemod queries this table and sees this record has the flag of "N" (for new).

Sourcemod sends this message to the server in chat and then updates the flag for record 1 from N to S (for sent)

...:: TnT Edit ::...

Then if more come in, sourcemod just handles them one record at a time and since at the conclusion of handling the row it updates the flag to S, it won't come into contact with that one again...

select * from table_name where FLAG like 'N%'

I haven't messed with the sql functions for sourcemod yet, so I don't know if you have to declare things or what, but the above would be a sample select statement to get all records that need to be relayed to the in-game chat

...:: TnT Edit ::...
McFlurry is correct, I don't remember seeing any type of function that would allow sourcemod to be able to detect changes... a query that runs every 30 seconds or so would work though. depending on certain things :)

McFlurry
01-13-2012, 23:13
Time stamping the messages should also be included in the MySQL database.

TnTSCS
01-13-2012, 23:16
Time stamping the messages should also be included in the MySQL database.

true... my example was just a quick and dirty one :) I would add IP address of the person submitting for tracking purposes.

SQL_GetRowCount (http://docs.sourcemod.net/api/index.php?fastload=show&id=343&) would be an easy one to check if a new message is waiting to be sent to the in-game chat...

gamemann
01-14-2012, 16:52
My big question is, is it possible? And if it is can someone make it?

TnTSCS
01-14-2012, 18:07
oh, I thought you had made part of it :)... I just posted to another thread asking for the ability for a player on server-a to be able to chat to people on server-b... I'm thinking I might dive into that plugin and see what I can come up with.

After I'm done with that one, I'm pretty sure it would be simple enough to rip bits and pieces to make it work with a website - but I'm no web person, so I can't help you there.

gamemann
01-14-2012, 18:31
i have the database and php webpage ready just i need the php code for it.

UltraRazor
01-15-2012, 15:50
So, as I understand, you have such plugin for sourcemod with connection to the database.
And you need a web-interface and PhP-script to see a results in the webpage.
I was looking for such plugin for much time and if you give it, we will be able to make a web-interface.

UltraRazor
01-15-2012, 16:12
oh, I thought you had made part of it :)... I just posted to another thread asking for the ability for a player on server-a to be able to chat to people on server-b... I'm thinking I might dive into that plugin and see what I can come up with.

After I'm done with that one, I'm pretty sure it would be simple enough to rip bits and pieces to make it work with a website - but I'm no web person, so I can't help you there.
That thread was posted by myself.
I think, booth ideas will be very usefull for the users of this community.
And I'm ready to give you some $ as a stimulus to create this thing.

gamemann
01-15-2012, 16:26
Yeah we need a good coder. I am not that good enough to make an advanced plugin like this. I could maybe try the php part. I got a database to try it on, also a web machine.

UltraRazor
01-15-2012, 16:50
Yeah we need a good coder. I am not that good enough to make an advanced plugin like this. I could maybe try the php part. I got a database to try it on, also a web machine.

I think, that it's more simple to create web with the help of Ajax.
Ajax can easily take info from database.