1. Post #1

    January 2012
    29 Posts
    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 )

    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 )

    Any help would be much appreciated.
    Reply With Quote Edit / Delete Reply Windows 7 New Zealand Show Events Dumb Dumb x 2Optimistic Optimistic x 1 (list)

  2. Post #2
    I call in friends to rate KatNotDinner dumb (lol)
    nick_9_8's Avatar
    December 2011
    1,650 Posts
    Reply With Quote Edit / Delete Reply Windows 7 Australia Show Events Informative Informative x 1Friendly Friendly x 1 (list)

  3. Post #3
    Dragon Dildoes
    Dennab
    April 2009
    4,432 Posts
    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.
    Reply With Quote Edit / Delete Reply Windows 7 Germany Show Events Agree Agree x 4 (list)

  4. Post #4
    JustSoFaded's Avatar
    December 2011
    432 Posts
    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.
    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.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 2 (list)

  5. Post #5
    Gold Member
    Trumple's Avatar
    September 2009
    6,147 Posts
    How are you detecting when the transaction has happened? I attempted this a while ago, I ended up giving up on PayPal's API

  6. Post #6
    Dragon Dildoes
    Dennab
    April 2009
    4,432 Posts
    That's not the point, just because you were unable to do it that doesn't mean others can't do it.
    Reply With Quote Edit / Delete Reply Windows 7 Germany Show Events Dumb Dumb x 3Agree Agree x 1 (list)

  7. Post #7
    JustSoFaded's Avatar
    December 2011
    432 Posts
    PayPal has pretty decent documentation on the IPN, you should check it out. They pretty much give you full working code.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 3 (list)

  8. Post #8
    foxcock
    Bletotum's Avatar
    June 2008
    6,873 Posts
    That's not the point, just because you were unable to do it that doesn't mean others can't do it.
    He was asking a question, not attempting to discourage others to try.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 1 (list)

  9. Post #9
    ash47's Avatar
    March 2010
    724 Posts
    You can use php RCON apis, login to your servers RCON, and call a console command that does it :P

  10. Post #10
    zachy64's Avatar
    July 2012
    54 Posts
    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)

  11. Post #11
    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.
    Reply With Quote Edit / Delete Reply Windows 7 Show Events Optimistic Optimistic x 1 (list)

  12. Post #12
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,077 Posts
    You can use php RCON apis, login to your servers RCON, and call a console command that does it :P
    http://fremnet.net/article/199/source-rcon-class

    I use this one, needs only few changes to work perfectly.

    Just send a command to the server with the players' SteamID and the ID of the product purchased. Then let the server handle how to deal with it, if they're online you won't probably have to change the Database. If they are offline just change the database.

  13. Post #13
    JustSoFaded's Avatar
    December 2011
    432 Posts
    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.
    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..

  14. Post #14
    I call in friends to rate KatNotDinner dumb (lol)
    nick_9_8's Avatar
    December 2011
    1,650 Posts
    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.