1
2
I wanted to create promotions in my game, with the Following scheme: he paid, after I sent the code example D342FvY2 he typed it into an input and earned what he bought, but did not want to shut down the game compiles and get back in the online world
|
It would probably be wise to randomize the promo codes using 8 characters (num or text). Then make a check to see if an existing promo code was already used; If so, have it generate a new code, etc...
|
If you use some simple Export() and php, you can have it set so when they purchase a code online, PHP will generate the code and will add it to a .txt document.
There will be another .txt document for the previously entered codes too, so you don't get duplicates. (An Alternative to this could be MySQL) When the user enters the promo code in Dream Seeker(your game), use the code world.Export("http://www.yoursite.com/promocode.php?action=confirm&code=[entered_text]") and say you have a file called "promocode.php" on your website. Use the $_GET['action'] and the $_GET['code'] to see what to do to pass the "GET" arguments, well read the "GET" arguments. Check if the code exists in the .txt document with the available codes but not in the .txt document for the previously generated codes. If the above is true, they get the promo code bonus whatever and add the code they entered to the previously generated code, otherwise don't give it to them because they are trying to cheat or entered a previously used code. |
Hi there :P Well, i'm assuming that you want the player to buy the code with in-game money. This should work:
mob/player I hope that I could help ,MistY, |
In response to Misticone
|
|
Misticone wrote:
Hi there :P Well, i'm assuming that you want the player to buy the code with in-game money. This should work: mob/player
Nice snippet except I can use the promotional code infinitely! |
Oh yeah, you're completly correct. Hummmm maybe this solves the problem (so the code can only be used one)
mob/player/verb/Inset_Code(n as text) Thanks, ,MistY, |
Once again this code is buggy.
Alert() doesn't return until Ok is clicked. You can enter it as many times as you like, then hit Ok on the alert and it will be accepted multiple times. |
In response to Ssj4justdale
|
|
Ssj4justdale wrote:
If you use some simple Export() and php, you can have it set so when they purchase a code online, PHP will generate the code and will add it to a .txt document. world.Export("http://www.yoursite.com/promocode.php?action=confirm&code=[entered_text]") and say you have a file called "promocode.php" on your website. There is another solution without using MySQL? something like promocodes.ini |
.ini is just a text file. You can write them into a BYOND save file, a text file, or any other type of file. Sqlite would work too, which is now naively in BYOND.
You have to trust your host for this though. |
In response to Gabriel001
|
|
Gabriel001 wrote:
Ssj4justdale wrote: world.Export("http://www.yoursite.com/promocode.php?action=confirm&code=[entered_text]") and say you have a file called "promocode.php" on your website. Message me on Skype @ [email protected] and I can assist you much faster since this may require a bit of explaining. |
In response to Gabriel001
|
|
Gabriel001 wrote:
I need help!!!!!!!! I knew Dale wasn't up for it... Well, what do you need? We the BYOND Community are here for you. |
I have a nice PayPal library you could use, it using PayPal's IPN and inserts into a MySQL database, from there the user can pay for gold in games items etc...
|
A.T.H.K can you send this to me as well? I've always wanted to learn and more or less try to get the grip on how such process works.
|
PayPal has it's API's listed as well as various documentations to explain how you could integrate the service; you all don't have to hound him for his implementation if you just knew how to program.
|
You know, there are quite a number of ways to aid somebody who is in search for help. You obviously can't refrain from insulting somebody who doesn't have the same knowledge as yourself. This is quite unnecessary as this is under "Developer Help" section for a reason which you clearly don't, or simply refuse to recognize.
Going by your logic nobody should ask for help here because everything you could possibly need help in will already be documented.. In the end, this is obviously ATHK's decision, but I am quite irritated by your response. |
1
2
If in-game, you can just store them in a list and add new elements to that list as needed: