Raised This Month: $ Target: $400
 0% 

Run PHP code inside plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-10-2018 , 19:29   Re: Run PHP code inside plugin.
Reply With Quote #1

I would love it if it were possible to somehow internally link events in the MOTD to a plugin. I have a use case for this. But unfortunately, it can't .
__________________

Last edited by fysiks; 05-10-2018 at 19:30.
fysiks is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-11-2018 , 12:17   Re: Run PHP code inside plugin.
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
I would love it if it were possible to somehow internally link events in the MOTD to a plugin. I have a use case for this. But unfortunately, it can't .
What do you mean by events? You can send commands/information to HLDS from MOTD through javascript and/or PHP and rcon.
__________________

Last edited by Black Rose; 05-11-2018 at 12:17.
Black Rose is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-12-2018 , 02:36   Re: Run PHP code inside plugin.
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
What do you mean by events? You can send commands/information to HLDS from MOTD through javascript and/or PHP and rcon.
Clicking a link or pressing a button would be an event. I know how to do it via RCON but it would be nice to do it purely internal to the server.
__________________
fysiks is offline
GoldNux
Senior Member
Join Date: Mar 2018
Old 05-12-2018 , 15:45   Re: Run PHP code inside plugin.
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Clicking a link or pressing a button would be an event. I know how to do it via RCON but it would be nice to do it purely internal to the server.
Can it be done using SQL?
I don't know much about this but I'm thinking something like:
Action on MOTD webpage changes something in a database, amx plugin somehow notices that change.
I have a plugin that inserts data from the game to a database, don't know if it is possible to do the opposite..
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731
GoldNux is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-12-2018 , 17:49   Re: Run PHP code inside plugin.
Reply With Quote #5

Quote:
Originally Posted by GoldNux View Post
Can it be done using SQL?
I don't know much about this but I'm thinking something like:
Action on MOTD webpage changes something in a database, amx plugin somehow notices that change.
I have a plugin that inserts data from the game to a database, don't know if it is possible to do the opposite..
SQL is just that, a database. To use that in the way you describe you have to check for updates in the database in a loop. It's very inefficient, though possible.

Through rcon you can send the server a command which is pretty much the same as someone typing a command in console. That way there's no update loop, just a public function that reacts instantly.
__________________

Last edited by Black Rose; 05-12-2018 at 17:51.
Black Rose is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-12-2018 , 20:48   Re: Run PHP code inside plugin.
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
I would love it if it were possible to somehow internally link events in the MOTD to a plugin. I have a use case for this. But unfortunately, it can't .
How would the ideal API look? How would you prefer it to work?
__________________
klippy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-12-2018 , 21:31   Re: Run PHP code inside plugin.
Reply With Quote #7

Quote:
Originally Posted by KliPPy View Post
How would the ideal API look? How would you prefer it to work?
I haven't really thought about it that much. It would probably have to be implemented in the client since that's where the MOTD web browser is running. In my case, it would need to be able to trigger sending a command to the server (similar to typing a command into the console, essentially client_cmd()).

This certainly won't be happening and I don't want to use any solution that requires the RCON password. Also opening another avenue of communication with the server like a plugin-based web server has its own issues because it would be a public interface that can be abused easily.
__________________
fysiks is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-13-2018 , 04:01   Re: Run PHP code inside plugin.
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
I haven't really thought about it that much. It would probably have to be implemented in the client since that's where the MOTD web browser is running. In my case, it would need to be able to trigger sending a command to the server (similar to typing a command into the console, essentially client_cmd()).

This certainly won't be happening and I don't want to use any solution that requires the RCON password. Also opening another avenue of communication with the server like a plugin-based web server has its own issues because it would be a public interface that can be abused easily.
Well it can only happen through HTTP, so you'll have to live with that. Opening a HTTP port and whitelisting request to only be accepted from those players playing on the server at that moment would be alright I guess.
__________________
klippy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode