Is there any way for me to send a signal from PHP to lua directly?
The way it should work is that people donate, then the php script sends their steam ID and some other info over to lua. (good, although probably not the best practice :smile:)
The way it currently works is that people donate and the php adds their steam id into a database, which only loads at the next map change. (Bad because the map changes after a a long time :pwn:)
Any help would be much appreciated.
Look at this: [URL="https://github.com/koraktor/steam-condenser"]https://github.com/koraktor/steam-condenser[/URL]
You could try to use one of the socket modules to accept a simple http connection, but I guess it would be easier to just let php insert into the database and make the server poll every x seconds.
[QUOTE=Wizard of Ass;37994814]You could try to use one of the socket modules to accept a simple http connection, but I guess it would be easier to just let php insert into the database and make the server poll every x seconds.[/QUOTE]
This. It's probably the least complicated way, and probably also the most common. If you really wanted to be fancy you could use sockets, but I don't see the point.
How are you detecting when the transaction has happened? I attempted this a while ago, I ended up giving up on PayPal's API
That's not the point, just because you were unable to do it that doesn't mean others can't do it.
PayPal has pretty decent documentation on the IPN, you should check it out. They pretty much give you full working code.
[QUOTE=Wizard of Ass;37995336]That's not the point, just because you were unable to do it that doesn't mean others can't do it.[/QUOTE]
He was asking a question, not attempting to discourage others to try.
You can use php RCON apis, login to your servers RCON, and call a console command that does it :P
You could run the update code that you would use at the beginning of the map every few minutes or at the end of a round (Unless you're on sandbox, that wouldn't work)
What I do is I make the php script write a file in to the garrysmod/data/playerdonations folder called 12345.txt (steam_0:1:12345) with information that can be processed in lua. Remember to append, not overwrite. The server checks if the file exists when the player joins and then gives them stuff, after moving the file to garrysmod/data/completedplayerdonations. You need to make sure your data folder is writable. If you don't have access (you're on a GSP) then you could make use of http.Fetch to read stuff from your website.
[QUOTE=JetBoom;38006937]What I do is I make the php script write a file in to the garrysmod/data/playerdonations folder called 12345.txt (steam_0:1:12345) with information that can be processed in lua. Remember to append, not overwrite. The server checks if the file exists when the player joins and then gives them stuff, after moving the file to garrysmod/data/completedplayerdonations. You need to make sure your data folder is writable. If you don't have access (you're on a GSP) then you could make use of http.Fetch to read stuff from your website.[/QUOTE]
So...you write a new file for each player with their steamID, and then MOVE the file to another folder after giving each person their items? On each map start? That seems terribly inefficient..
Can anybody show me their lua for connecting to a database an processing the donations. I'm curious about using a database incase the PHP sends a message to my server... If the server has crashed for some reason we're in trouble :/
If anybody could show how their doing it, it would be very much appreciated.
Sorry, you need to Log In to post a reply to this thread.