Jump to content
MakeWebGames

Recommended Posts

Posted

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.

Posted

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?

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...