blackjack mod fix to work with points

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   blackjack mod fix to work with points
craigmack
CZ Active Member
 Codezwiz Site Donator
craigmack has been a member for over 19 year's 19 Year Member
usa.gif michigan.gif
Age: 46
Gender: Male
Fav. Sports Team: Pistons
Status: Offline
Joined: Feb 15, 2005
0.02 posts per day
Posts: 147
Points: 6,072
   
I seen alot of posts about the blackjack mod not giving points or taken away points so i did this fix


In functions_blackjack.php at the bottom
find this

function GivePoints($user, $bet, $reward_timez)
   {
      global $db, $prefix;
      
   $new = $bet * $reward_timez;
   
      $q = "UPDATE ". $prefix ."_users
           SET user_points = user_points + '$new'
           WHERE username = '$user'";
      $r = $db -> sql_query($q);
   return;   
   }

function TakePoints($user, $bet)
   {
      global $db, $prefix;
         
      $q = "UPDATE ". $prefix ."_users
           SET user_points = user_points - '$bet'
           WHERE username = '$user'";
      $r = $db -> sql_query($q);
   return;   
   }




Change to this

function GivePoints($user, $bet, $reward_timez)
   {
      global $db, $prefix;
      
   $new = $bet * $reward_timez;
   
      $q = "UPDATE ". $prefix ."_users
           SET points = points + '$new'
           WHERE username = '$user'";
      $r = $db -> sql_query($q);
   return;   
   }

function TakePoints($user, $bet)
   {
      global $db, $prefix;
         
      $q = "UPDATE ". $prefix ."_users
           SET points = points - '$bet'
           WHERE username = '$user'";
      $r = $db -> sql_query($q);
   return;   
   }      


The problem with the code as it stands when you edit blackjack.php it would show the points table but would update your points to the user_points table.
This fix is for the nuke points, leave as is for cash mod


Back to top Reply with quote
#2   
aUsTiN
CZ Active Member
aUsTiN has been a member for over 20 year's 20 Year Member
usa.gif georgia.gif
Age: 41
Gender: Male
Website:
Status: Offline
Joined: Sep 09, 2003
0.02 posts per day
Posts: 142
Points: 57
  MSN Messenger 
A better "fix" would be to global the string i used in blackjack.php & then replace 'points' with the $string_name.....



Back to top Reply with quote
#3   re: blackjack mod fix to work with points
craigmack
CZ Active Member
 Codezwiz Site Donator
craigmack has been a member for over 19 year's 19 Year Member
usa.gif michigan.gif
Age: 46
Gender: Male
Fav. Sports Team: Pistons
Status: Offline
Joined: Feb 15, 2005
0.02 posts per day
Posts: 147
Points: 6,072
   
The fix i had above helped me out if you have one share it



Back to top Reply with quote
#4   
aUsTiN
CZ Active Member
aUsTiN has been a member for over 20 year's 20 Year Member
usa.gif georgia.gif
Age: 41
Gender: Male
Website:
Status: Offline
Joined: Sep 09, 2003
0.02 posts per day
Posts: 142
Points: 57
  MSN Messenger 
Your fix will work, but what i was suggesting is a proper fix where nothing in the SQL would have to be hard coded. Something along these lines, as this is from my file (which is a newer version & is for phpBB standalone), but you should be able to understand what i am meaning for a bit better of a fix.


      /* Edit This ONLY IF YOURS IS DIFFERENT */
   $points_name    = $board_config['points_name'];


Is in the BalckJack.php file, so take it into the functions file.... Mine would look like

function GivePoints($user, $bet, $reward_timez)
   {
   global $db, $points_name;
      
   $new = $bet * $reward_timez;
   
      $q = "UPDATE ". USERS_TABLE ."
           SET ". $points_name ." = ". $points_name ." + '". intval($new) ."'
           WHERE username = '". addslashes(stripslashes($user)) ."'";
      $db->sql_query($q);
   return;   
   }

function TakePoints($user, $bet)
   {
   global $db, $points_name;
         
      $q = "UPDATE ". USERS_TABLE ."
           SET ". $points_name ." = ". $points_name ." - '". intval($bet) ."'
           WHERE username = '". addslashes(stripslashes($user)) ."'";
      $db->sql_query($q);
   return;   
   }


Maybe give that a try for a more proper fix?


Back to top Reply with quote
#5   
aUsTiN
CZ Active Member
aUsTiN has been a member for over 20 year's 20 Year Member
usa.gif georgia.gif
Age: 41
Gender: Male
Website:
Status: Offline
Joined: Sep 09, 2003
0.02 posts per day
Posts: 142
Points: 57
  MSN Messenger 
Guess thats that then......



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum