Author Topic: SMFShop and SMF Arcade  (Read 14814 times)

Offline matkins70

Re: SMFShop and SMF Arcade
« Reply #15 on: September 11, 2006, 07:53:10 am »
Yay, after changing that, and editing a couple more things, and now its working, thanks a lot.  Sorry about my lack of knowledge, had never touched php until last week.

Offline Daniel15

Re: SMFShop and SMF Arcade
« Reply #16 on: September 16, 2006, 12:58:14 pm »
OK, I'm glad that you got it working :)
I'm assuming that you realised that {&winnings} was meant to be {$winnings}?

If you want to learn PHP, there's heaps of good tutorials, just search Google to find some. I think that W3Schools has some

Offline matkins70

Re: SMFShop and SMF Arcade
« Reply #17 on: September 17, 2006, 03:10:26 am »
yeah, realised that, thanks.

Offline TechnoDragon

Re: SMFShop and SMF Arcade
« Reply #18 on: September 20, 2006, 01:30:12 am »
Alright, over at SMF Arcade they came up with the code to award points when you get champion in a particular game, but they could not figure out how to show the award...it just is given.  Any chance of you guys here being able to help me out to make it that when they get the champion it also says they've been awarded the points?

Also, Theye have released an Awards mod for SMF.  any possibility of tying it in wit hthe shop as well so that if members are given an award they are awarded points as well?
Don't tell me to get into shape...I have a shape...It is round!


Offline Rezet

Re: SMFShop and SMF Arcade
« Reply #19 on: January 21, 2007, 05:55:10 am »
Can you help me how to integrate SMF Shop and SMF Arcade?
I want my users to buy tickets for games, and win or lose credits...
We always glad to see you in Siberia!

Offline Luxsphinx

Re: SMFShop and SMF Arcade
« Reply #20 on: January 21, 2007, 06:35:53 am »
Yes, I to would like to link my SMF Shop with my SMF Arcade so that getting high scores or championships will give the user credits.  If anyone could supply that code or a place to get it, that would be great!

Offline perplexed

Re: SMFShop and SMF Arcade
« Reply #21 on: February 07, 2007, 11:42:38 pm »
Thanks daniel.  Basil had just beaten you to it with a personal message :P

Been updating a few things with the shop, quite a fun little project.  I now have it set up so if someone gets a new highscore in the arcade, then they get given 50 credits.  My multiplier is up, though im not completely happy with it, but all in due course.

My next task is to make a scratchcard.  I think i mentioned it before.   Im trying to think of the best way to get the weighted results, so that basically, there is a 40% chance of 0, 20% of 100 credits, 5% of X credits, and so on.  My only idea at the moment is to use the rand feature to generate a number between 1 - 100, and then that correspondes to the percentage.  So 1-40 is 0 returns, 41-60 is 100 credits, etc, all the way to 100.

Anyone think of a better solution, as im not very trusting of the random thing, as my results see a little strnage...

I wondered if this was made available for others Matkins, as it sounds pretty cool but I dont see the download on this site?

~Thanks
Estne volumen in toga, an solum tibi libet me videre?

Offline matkins70

Re: SMFShop and SMF Arcade
« Reply #22 on: February 08, 2007, 06:43:16 am »
What, the Scratchcard?  Err, I could post up the code i suppose.

Offline TechnoDragon

Re: SMFShop and SMF Arcade
« Reply #23 on: February 08, 2007, 01:28:02 pm »
the random money item works perfectly as a scratchcard
Don't tell me to get into shape...I have a shape...It is round!


Offline perplexed

Re: SMFShop and SMF Arcade
« Reply #24 on: February 14, 2007, 09:26:16 pm »
What, the Scratchcard?  Err, I could post up the code i suppose.

I just thought it sounded cool, better than just random money
Estne volumen in toga, an solum tibi libet me videre?

Offline Kimojuno

Re: SMFShop and SMF Arcade
« Reply #25 on: February 22, 2007, 08:06:21 am »
Been updating a few things with the shop, quite a fun little project.  I now have it set up so if someone gets a new highscore in the arcade, then they get given 50 credits.

Just wondering what the code is. I've looked around for awhile and haven't found any yet, in fact pretty much every SMF Webmaster seems to be asking around for such codes. I could be blind and it's on the forum, but I haven't noticed it around.

Offline TechnoDragon

Re: SMFShop and SMF Arcade
« Reply #26 on: February 25, 2007, 01:43:20 pm »
Ok, here's the code I use in my arcade to give credits anytime someone gets a new high score...I have this set that the first score they submit they get nothing, but every new score that is a high score after that they do...I am also using the Powered by modified version E1.5 of the arcade...but here's  the code that you need to look for (in that version at least)
Code: [Select]
//player has new high score and gets to comment - winner :)
{
if($context['arcade']['submit']['looser'] == '1')
{

And then add after it this bit of code:
Code: [Select]
db_query("
UPDATE {$db_prefix}members
SET money = (money + 250)
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);

If you want to let them know they have won the money change the text string underneath that to this:
Code: [Select]
echo '',$txt['arcade_1258'],' ',$txt['arcade_1262'],' ',$context['arcade']['submit']['score'],'<br />',$txt['arcade_1264'],'<br /><strong>You have received 500',$modSettings['shopCurrencySuffix'],'!</strong><br />', implode($txt['arcade_or'],$choice), '<br />';

Not that I have it set to 500 credits...the reason that the query does 250 is because they get the first 250 when they get to the screen, and then they get another 250 when they submit their comment...

Hope this helps everyone...
Don't tell me to get into shape...I have a shape...It is round!


Offline perplexed

Re: SMFShop and SMF Arcade
« Reply #27 on: February 28, 2007, 11:19:35 am »
What, the Scratchcard?  Err, I could post up the code i suppose.

any chance?  I can't code so I'm at your mercy :)
Estne volumen in toga, an solum tibi libet me videre?

Offline TechnoDragon

Re: SMFShop and SMF Arcade
« Reply #28 on: February 28, 2007, 02:23:27 pm »
Thanks go to Feildmaster at my forum for this one...9 hours of no sleep can really produce some tremendous results!
Please Note this in only tested to work on Arcade version 1.5.2 and 1.5.3!
Ok, first in your Sources directory, open Arcade.php and find:
Code: [Select]
if(!isset ($row_check['plays']) )
{
Add this after:
Code: [Select]
db_query("
UPDATE {$db_prefix}members
SET money = (money + 50)
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
NOTE: Change the 50 to whatever amount you want to give the member playing for submitting a score for the first time...

Then find:
Code: [Select]
elseif((($gameSubmitArray['highscore']==0)&&($row_check['score']< $gameSubmitArray['score'])&&($row_check['plays'] >= 1 ))||(($gameSubmitArray['highscore']==1)&&($row_check['score']> $gameSubmitArray['score'])&&($row_check['plays'] >= 1 )))
{
add this after it:
Code: [Select]
db_query("
UPDATE {$db_prefix}members
SET money = (money + 250)
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
NOTE: Change the 250 to whatever you want them to get when they get a new high score (not champ)

Then find this:
Code: [Select]
$results = db_query($sql, __FILE__, __LINE__);
$looser = '0';
}

Then add this right after:
Code: [Select]
//player is champion
elseif((($gameSubmitArray['highscore']==1) && ($gameSubmitArray['champion_score'] < $gameSubmitArray['score'])) || (($gameSubmitArray['highscore']==0) && ($gameSubmitArray['champion_score'] < $gameSubmitArray['score'])))
{
db_query("
UPDATE {$db_prefix}members
SET money = (money + 1000)
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
//update score, players number of plays, time played and total plays for the game
$sql = "UPDATE {$db_prefix}games_high "
. "SET score = {$gameSubmitArray['score']} , plays = plays+1, stime = {$gameSubmitArray['timenow']}, warning = {$gameSubmitArray['warning']},ptime = {$gameSubmitArray['timenow']}, playscore = {$gameSubmitArray['score']},duration = duration+{$gameSubmitArray['duration']},ip='{$ip}' "
. "WHERE id='{$row_check['id']}' ";
$results = db_query($sql, __FILE__, __LINE__);
//set for congrats in template */
$looser = '3';
}
NOTE: Again change the 1000 to the amount you want your members to receive for becoming the champion!

Now for the text strings!
In your default theme open up Arcade.template.php and find this:
Code: [Select]
if($context['arcade']['submit']['looser'] == '0')

change the echo statement right below it to this:
Code: [Select]
echo '</',$txt['arcade_1260'],' ',$txt['arcade_1262'],' ',$context['arcade']['submit']['score'],'<br />',$txt['arcade_1264'],'<br /><strong>You have received 50 ',$modSettings['shopCurrencySuffix'],'!</strong> Just for playing this game!<br />', implode($txt['arcade_or'],$choice), '<br />';

then find this:
Code: [Select]
if($context['arcade']['submit']['looser'] == '1')

and change the echo statement below to this:
Code: [Select]
echo '',$txt['arcade_1258'],' ',$txt['arcade_1262'],' ',$context['arcade']['submit']['score'],'<br />',$txt['arcade_1264'],'<br /><strong>You have received 250',$modSettings['shopCurrencySuffix'],'!</strong><br />', implode($txt['arcade_or'],$choice), '<br />';

then find this:
Code: [Select]
//player has new high score and gets to comment - winner :)
{

and add this right after it:
Code: [Select]
if($context['arcade']['submit']['looser'] == '3')
{
echo '<strong>Congratulations! You are the new champion with the score of ',$context['arcade']['submit']['score'],'!<br />You have received 1000',$modSettings['shopCurrencySuffix'],' as a prize!</strong><br />', implode($txt['arcade_or'],$choice), '<br />'; }

Now, not only will your members get rewarded for playing, beating their old high score or becvoming the champ...they will see it too!
Don't tell me to get into shape...I have a shape...It is round!


Offline Hambil

Re: SMFShop and SMF Arcade
« Reply #29 on: March 10, 2007, 05:10:16 am »
I've just released an integration for the shop and the arcade. I hope you enjoy it.

http://www.daniel15.com/forum/index.php/topic,668.0.html