gurpreet Posted March 29, 2010 Posted March 29, 2010 I was trying to create a small mod that rewards the players if they are active and a seperate if they are donator. Something like this $active = unix_timestamp - 259200; maybe something like if($active == 1) { $db->query("UPDATE users set active = 1 where userid = $r['userid']"); } else { } if($r['active'] == 1 && $r['donatordays'] > 0) { $db->query("UPDATE users SET activepoints = activepoints + 2 where userid = $r['userid']"); } else if($r['active'] == 1) { $db->query("UPDATE users SET activepoints = activepoints + 1 where userid = $r['userid']"); } I was thinking of how to get the active to like check if the player has been on inthe last 3 days. If they have then give them the stuff. Quote
iSOS Posted March 29, 2010 Posted March 29, 2010 if(time() - $ir['laston'] < 259200) { Blah } That should probably work. Quote
gurpreet Posted March 29, 2010 Author Posted March 29, 2010 if(time() - $ir['laston'] < 259200) { $db->query("UPDATE users set active = 1 where userid = $r['userid']"); } else {} if($r['active'] == 1 && $r['donatordays'] > 0) { $db->query("UPDATE users SET activepoints = activepoints + 2 where userid = $r['userid']"); } else if($r['active'] == 1) { $db->query("UPDATE users SET activepoints = activepoints + 1 where userid = $r['userid']"); } So like that? Or would it be $ir? Quote
gurpreet Posted March 29, 2010 Author Posted March 29, 2010 I have the following in a seperate test file: <?php include "config.php"; include "globals.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; if(time() - $ir['laston'] < 259200) { $db->query("UPDATE users set active = 1 where userid = {$ir['userid']}"); } else {} if($ir['active'] == 1 && $ir['donatordays'] > 0) { $db->query("UPDATE users SET activepoints = activepoints + 2 where userid = {$ir['userid']}"); } else if($ir['active'] == 1) { $db->query("UPDATE users SET activepoints = activepoints + 1 where userid = {$ir['userid']}"); } $points = abs(@intval($_GET['activepoints'])); print "You have $points points."; ?> 1) print nor echo outputs the text. 2) The activepoints don't update even though a few people have active=1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.