A little help

Ask for help or introduce yourself to the community here. This is also an academy for new players/members.
Post Reply
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

Hey! I am wondering if anyone here could help me. I am trying to use the treasury code as a template to make a code for people to have their personal treasury. It seems to be more or less working apart from when you deposit something the error message comes out as:
FATAL ERROR: Failed to update player data granary=111111111,loft=0,treasury='' for user #1!
You have completed the transaction. Results:
Gave 1,111 runes.
The code is

code: Select all

 <?
include("header.php");


//is officer?
$officer = 0;
if($users[num] == $stockpile[founder] || $users[num] == $stockpile[asst] || $users[num] == $stockpile[fa1] || $users[num] == $stockpile[fa2]) {
	$officer = 1;
}

// Mods for how much food/cash/or runes

$cash_mod = 200; // net * what = limit;
$food_mod = 150/$config[food]; // net * what = limit;
$rune_mod = $food_mod; // net * what = limit;

// Find the total net of stockpile.

$totalnet = sqleval("SELECT sum(networth) FROM $stockpiledb WHERE land>0 AND disabled != 2 AND stockpile=$users[stockpile];");

// Limits

$limit_food =  $food_mod * 1000000;
$limit_cash = 1000000 * $cash_mod;
$limit_rune = 1000000 * $rune_mod;

$show_limit_food = $limit_food;
$show_limit_cash = $limit_cash;
$show_limit_rune = $limit_rune;

if($limit_food < $stockpile[granary])
	$limit_food = $stockpile[granary];
if($limit_cash < $stockpile[stockpile])
	$limit_cash = $stockpile[stockpile];
if($limit_rune < $stockpile[loft])
	$limit_rune = $stockpile[loft];

$ucglimit = min($users[cash], $limit_cash-$stockpile[stockpile]);
$ufglimit = min($users[food], $limit_food-$stockpile[granary]);
$urglimit = min($users[runes], $limit_rune-$stockpile[loft]);
$uctlimit = $stockpile[stockpile];
$uftlimit = $stockpile[granary];
$urtlimit = $stockpile[loft];

if($stok_ch_open) {
	$stok = $stockpile['stok_open'];
	if($stok)
  $stok = 0;
	else
  $stok = 1;
	$stockpile['stok_open'] = $stok;
	savestockpileData($stockpile, "stok_open");
}


if($do_transaction) {
	// Fix our Input(s)
//echo "Cash T: $cash_take";

	fixInputNum($food_take);
	fixInputNum($food_give);

	fixInputNum($rune_take);
	fixInputNum($rune_give);

	fixInputNum($cash_take);
	fixInputNum($cash_give);

//echo "Cash T: $cash_take";

	if(!empty($_POST['ctmax']))  $cash_take = $uctlimit;
	if(!empty($_POST['ftmax']))  $food_take = $uftlimit;
	if(!empty($_POST['rtmax']))  $rune_take = $urtlimit;
	if(!empty($_POST['cgmax']))  $cash_give = $ucglimit;
	if(!empty($_POST['fgmax']))  $food_give = $ufglimit;
	if(!empty($_POST['rgmax']))  $rune_give = $urglimit;


	if($cash_give - $cash_take == 0 &&
    $food_give - $food_take == 0 &&
    $rune_give - $rune_take == 0)
  TheEnd("You're not doing anything in that transaction!");


	// Negative number?
	if($cash_take < 0 || $cash_give < 0 || $rune_take < 0 || $rune_give < 0 || $food_take < 0 || $food_give < 0)
  TheEnd("You may not take or give a negative amount");

	// Giving too much?
	if($cash_give > $users[cash] || $rune_give > $users[runes] || $food_give > $users[food])
  TheEnd("You don't have enough to deposit");

	// Taking too much?
	if($cash_take > $stockpile[stockpile] || $rune_take > $stockpile[loft] || $food_take > $stockpile[granary])
  TheEnd("You can't take that much.");

	// Give to user

	$users[food] += $food_take;
	$stockpile[granary] -= $food_take;

	$users[cash] += $cash_take;
	$stockpile[stockpile] -= $cash_take;

	$users[runes] += $rune_take;
	$stockpile[loft] -= $rune_take;


	// Give to stockpile

	$users[food] -= $food_give;
	$stockpile[granary] += $food_give;

	$users[cash] -= $cash_give;
	$stockpile[stockpile] += $cash_give;

	$users[runes] -= $rune_give;
	$stockpile[loft] += $rune_give;


	// Safety checks... incase I've missed it somewhere else
	if($stockpile[loft] < 0 || $stockpile[stockpile] < 0 || $stockpile[granary] < 0)
  TheEnd("You can't take that much.");

	if($users[runes] < 0 || $users[cash] < 0 || $users[food] < 0)
  TheEnd("You can't give that much.");


	// Over the limit?
	if($stockpile[granary] > $limit_food || $stockpile[stockpile] > $limit_cash || $stockpile[loft] > $limit_rune)
  TheEnd("You can't give that much.");


	if($stockpile['stok_open'] == 0 && $officer == 0) {
  if($cash_take > 0 || $rune_take > 0 || $food_take > 0)
  	TheEnd("Sorry, only the stockpile officers may take from the stockpile stockpile at this time!");
	}


	// Save up data

	saveUserDataNet($users, "food cash runes networth");
	saveUserData($users, "granary loft treasury");

	// Output

	$transaction = "";

	if($cash_give > 0) $transaction .= "Gave \$" . commas($cash_give) . ". \n<br>";
	if($cash_take > 0) $transaction .= "Took \$" . commas($cash_take) . ". \n<br>";

	if($food_give > 0) $transaction .= "Gave " . commas($food_give) . " food. \n<br>";
	if($food_take > 0) $transaction .= "Took " . commas($food_take) . " food. \n<br>";

	if($rune_give > 0) $transaction .= "Gave " . commas($rune_give) . " runes. \n<br>";
	if($rune_take > 0) $transaction .= "Took " . commas($rune_take) . " runes. \n<br>";

	{
  if($member[num] != $users[num] )
  	addNews(501, array(stockpile1=>$users[stockpile], id1=>$member[num], id2=>$users[num],	food1=>($food_give-$food_take),
            	cash1=>($cash_give-$cash_take),
            	runes1=>($rune_give-$rune_take)));
    //News to members
  if($member[num] == $users[num] )
  	addNews(502, array(stockpile1=>$users[stockpile], id1=>$users[num],  	food1=>($food_give-$food_take),
            	cash1=>($cash_give-$cash_take),
            	runes1=>($rune_give-$rune_take)));
	
    //News to self
	}

	$tpl->assign("trans", $transaction);

	// Send to stockpile leader? Store in table?
}

$co = 'Open';
$nco = 'Open';
if($stockpile['stok_open']) {
	$co = 'Open';
	$nco = 'Open';
}

// Assign to template.

$tpl->assign('limit_food', commas($show_limit_food));
$tpl->assign('limit_rune', commas($show_limit_rune));
$tpl->assign('limit_cash', commas($show_limit_cash));

$tpl->assign('officer', $officer);
$tpl->assign('stok_open', $co);
$tpl->assign('nco', $nco);

$tpl->assign('curr_food', commas($stockpile[granary]));
$tpl->assign('curr_rune', commas($stockpile[loft]));
$tpl->assign('curr_cash', commas($stockpile[stockpile]));
$tpl->assign('stockpile_name', $stockpile[name]);

if($transaction != "") $tpl->assign('trans', $transaction);

$tpl->display('stockpile.html');

echo "<hr>";
include("stok-news.php");

TheEnd('');
?>
Some of the things I have played around with a bit (eg $limit_food = $food_mod * 1000000;) but I would like to keep them as they are for now if they don't need changing to get rid of the error.

I would be greatful if anyone could help out.
~Slasher :)
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

Ok I got rid of the error message at the top now... The only problem is when I deposit something and then go to another page then back to the personal treasury all the stuff that i deposited is gone... Any help would be greatly appreciated :)
~Slasher
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

Do an error_reporting(E_ALL); at the top and then tell us what happens...
:wq
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

ok thanks :)

WOW!
At the top of everything:
Notice: Undefined variable: users in /home/slasher/public_html/lib/status.php on line 2

Notice: Undefined index: basehref in /home/slasher/public_html/header.php on line 29

Notice: Use of undefined constant freeland - assumed 'freeland' in /home/slasher/public_html/lib/status.php on line 29

Notice: Use of undefined constant farms - assumed 'farms' in /home/slasher/public_html/lib/status.php on line 29

Notice: Use of undefined constant farms - assumed 'farms' in /home/slasher/public_html/lib/status.php on line 29

Notice: Use of undefined constant wizards - assumed 'wizards' in /home/slasher/public_html/lib/status.php on line 13

Notice: Use of undefined constant wpl - assumed 'wpl' in /home/slasher/public_html/lib/status.php on line 13

Notice: Use of undefined constant shops - assumed 'shops' in /home/slasher/public_html/funcs.php on line 281

Notice: Use of undefined constant pci - assumed 'pci' in /home/slasher/public_html/funcs.php on line 281

Notice: Use of undefined constant tax - assumed 'tax' in /home/slasher/public_html/lib/status.php on line 39

Notice: Use of undefined constant health - assumed 'health' in /home/slasher/public_html/lib/status.php on line 39

Notice: Use of undefined constant shops - assumed 'shops' in /home/slasher/public_html/lib/status.php on line 39

Notice: Use of undefined constant loan - assumed 'loan' in /home/slasher/public_html/lib/status.php on line 46

Notice: Use of undefined constant wizards - assumed 'wizards' in /home/slasher/public_html/lib/status.php on line 51

Notice: Use of undefined constant costs - assumed 'costs' in /home/slasher/public_html/lib/status.php on line 53

Notice: Use of undefined constant barracks - assumed 'barracks' in /home/slasher/public_html/lib/status.php on line 53

Notice: Use of undefined constant offsucc - assumed 'offsucc' in /home/slasher/public_html/funcs.php on line 1019

Notice: Use of undefined constant offtotal - assumed 'offtotal' in /home/slasher/public_html/funcs.php on line 1019

Notice: Use of undefined constant offsucc - assumed 'offsucc' in /home/slasher/public_html/funcs.php on line 1019

Notice: Use of undefined constant defsucc - assumed 'defsucc' in /home/slasher/public_html/funcs.php on line 1020

Notice: Use of undefined constant deftotal - assumed 'deftotal' in /home/slasher/public_html/funcs.php on line 1020

Notice: Use of undefined constant defsucc - assumed 'defsucc' in /home/slasher/public_html/funcs.php on line 1020

Notice: Use of undefined constant health - assumed 'health' in /home/slasher/public_html/funcs.php on line 1033

Notice: Use of undefined constant health - assumed 'health' in /home/slasher/public_html/funcs.php on line 1035

Notice: Use of undefined constant health - assumed 'health' in /home/slasher/public_html/funcs.php on line 1037
Above the "stockpile thingy"
Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 8

Notice: Use of undefined constant asst - assumed 'asst' in /home/slasher/public_html/stockpile.php on line 8

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 8

Notice: Use of undefined constant fa1 - assumed 'fa1' in /home/slasher/public_html/stockpile.php on line 8

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 8

Notice: Use of undefined constant fa2 - assumed 'fa2' in /home/slasher/public_html/stockpile.php on line 8

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 8

Notice: Undefined variable: stockpiledb in /home/slasher/public_html/stockpile.php on line 20

Notice: Undefined index: stockpile in /home/slasher/public_html/stockpile.php on line 20

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 32

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 32

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 34

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 34

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 36

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 36

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 39

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 39

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 40

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 40

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 41

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 41

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 42

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 42

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 43

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 43

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 44

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 44

Notice: Undefined variable: stok_ch_open in /home/slasher/public_html/stockpile.php on line 46

Notice: Undefined variable: do_transaction in /home/slasher/public_html/stockpile.php on line 57

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 180

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 195

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 195

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 196

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 196

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 197

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 197

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 198

Notice: Undefined variable: transaction in /home/slasher/public_html/stockpile.php on line 200
I might be able to use them to help fix it *laughs* ill let you know how i get on (thats if you havent got a fix already *laughs*)
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

heres the code now...

code: Select all

<?
error_reporting(E_ALL); 
include("header.php");

// Mods for how much food/cash/or runes

$cash_mod = 200; // net * what = limit;
$food_mod = 150/$config[food]; // net * what = limit;
$rune_mod = $food_mod; // net * what = limit;

// Find the total net of stockpile.

$totalnet = sqleval("SELECT sum(networth) FROM $playerdb WHERE land>0 AND disabled != 2 AND stockpile=$users[stockpile];");

// Limits

$limit_food =  $food_mod * 1000000;
$limit_cash = 1000000 * $cash_mod;
$limit_rune = 1000000 * $rune_mod;

$show_limit_food = $limit_food;
$show_limit_cash = $limit_cash;
$show_limit_rune = $limit_rune;

if($limit_food < $stockpile[granary])
	$limit_food = $stockpile[granary];
if($limit_cash < $stockpile[stockpile])
	$limit_cash = $stockpile[stockpile];
if($limit_rune < $stockpile[loft])
	$limit_rune = $stockpile[loft];

$ucglimit = min($users[cash], $limit_cash-$stockpile[stockpile]);
$ufglimit = min($users[food], $limit_food-$stockpile[granary]);
$urglimit = min($users[runes], $limit_rune-$stockpile[loft]);
$uctlimit = $stockpile[stockpile];
$uftlimit = $stockpile[granary];
$urtlimit = $stockpile[loft];

if($stok_ch_open) {
	$stok = $stockpile['stok_open'];
	if($stok)
  $stok = 0;
	else
  $stok = 1;
	$stockpile['stok_open'] = $stok;
	savestockpileData($stockpile, "stok_open");
}


if($do_transaction) {
	// Fix our Input(s)
//echo "Cash T: $cash_take";

	fixInputNum($food_take);
	fixInputNum($food_give);

	fixInputNum($rune_take);
	fixInputNum($rune_give);

	fixInputNum($cash_take);
	fixInputNum($cash_give);

//echo "Cash T: $cash_take";

	if(!empty($_POST['ctmax']))  $cash_take = $uctlimit;
	if(!empty($_POST['ftmax']))  $food_take = $uftlimit;
	if(!empty($_POST['rtmax']))  $rune_take = $urtlimit;
	if(!empty($_POST['cgmax']))  $cash_give = $ucglimit;
	if(!empty($_POST['fgmax']))  $food_give = $ufglimit;
	if(!empty($_POST['rgmax']))  $rune_give = $urglimit;


	if($cash_give - $cash_take == 0 &&
    $food_give - $food_take == 0 &&
    $rune_give - $rune_take == 0)
  TheEnd("You're not doing anything in that transaction!");


	// Negative number?
	if($cash_take < 0 || $cash_give < 0 || $rune_take < 0 || $rune_give < 0 || $food_take < 0 || $food_give < 0)
  TheEnd("You may not take or give a negative amount");

	// Giving too much?
	if($cash_give > $users[cash] || $rune_give > $users[runes] || $food_give > $users[food])
  TheEnd("You don't have enough to deposit");

	// Taking too much?
	if($cash_take > $stockpile[stockpile] || $rune_take > $stockpile[loft] || $food_take > $stockpile[granary])
  TheEnd("You can't take that much.");

	// Give to user

	$users[food] += $food_take;
	$stockpile[granary] -= $food_take;

	$users[cash] += $cash_take;
	$stockpile[stockpile] -= $cash_take;

	$users[runes] += $rune_take;
	$stockpile[loft] -= $rune_take;


	// Give to stockpile

	$users[food] -= $food_give;
	$stockpile[granary] += $food_give;

	$users[cash] -= $cash_give;
	$stockpile[stockpile] += $cash_give;

	$users[runes] -= $rune_give;
	$stockpile[loft] += $rune_give;


	// Safety checks... incase I've missed it somewhere else
	if($stockpile[loft] < 0 || $stockpile[stockpile] < 0 || $stockpile[granary] < 0)
  TheEnd("You can't take that much.");

	if($users[runes] < 0 || $users[cash] < 0 || $users[food] < 0)
  TheEnd("You can't give that much.");


	// Over the limit?
	if($stockpile[granary] > $limit_food || $stockpile[stockpile] > $limit_cash || $stockpile[loft] > $limit_rune)
  TheEnd("You can't give that much.");


	if($stockpile['stok_open'] == 0 && $officer == 0) {
  if($cash_take > 0 || $rune_take > 0 || $food_take > 0)
  	TheEnd("Sorry, only the stockpile officers may take from the stockpile stockpile at this time!");
	}


	// Save up data

	saveUserDataNet($users, "food cash runes networth");
	saveUserData($users, "granary loft treasury");

	// Output

	$transaction = "";

	if($cash_give > 0) $transaction .= "Gave \$" . commas($cash_give) . ". \n<br>";
	if($cash_take > 0) $transaction .= "Took \$" . commas($cash_take) . ". \n<br>";

	if($food_give > 0) $transaction .= "Gave " . commas($food_give) . " food. \n<br>";
	if($food_take > 0) $transaction .= "Took " . commas($food_take) . " food. \n<br>";

	if($rune_give > 0) $transaction .= "Gave " . commas($rune_give) . " runes. \n<br>";
	if($rune_take > 0) $transaction .= "Took " . commas($rune_take) . " runes. \n<br>";

	{
  if($member[num] != $users[num] )
  	addNews(501, array(stockpile1=>$users[stockpile], id1=>$member[num], id2=>$users[num],	food1=>($food_give-$food_take),
            	cash1=>($cash_give-$cash_take),
            	runes1=>($rune_give-$rune_take)));
    //News to members
  if($member[num] == $users[num] )
  	addNews(502, array(stockpile1=>$users[stockpile], id1=>$users[num],  	food1=>($food_give-$food_take),
            	cash1=>($cash_give-$cash_take),
            	runes1=>($rune_give-$rune_take)));
	
    //News to self
	}

	$tpl->assign("trans", $transaction);

	// Send to stockpile leader? Store in table?
}

$co = 'Open';
$nco = 'Open';
if($stockpile['stok_open']) {
	$co = 'Open';
	$nco = 'Open';
}

// Assign to template.

$tpl->assign('limit_food', commas($show_limit_food));
$tpl->assign('limit_rune', commas($show_limit_rune));
$tpl->assign('limit_cash', commas($show_limit_cash));

$tpl->assign('officer', $officer);
$tpl->assign('stok_open', $co);
$tpl->assign('nco', $nco);

$tpl->assign('curr_food', commas($stockpile[granary]));
$tpl->assign('curr_rune', commas($stockpile[loft]));
$tpl->assign('curr_cash', commas($stockpile[stockpile]));
$tpl->assign('stockpile_name', $stockpile[name]);

if($transaction != "") $tpl->assign('trans', $transaction);

$tpl->display('stockpile.html');

echo "<hr>";
include("stok-news.php");

TheEnd('');
?>
and heres the errors:
Notice: Undefined index: stockpile in /home/slasher/public_html/stockpile.php on line 13

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 25

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 27

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 27

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 29

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 29

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 32

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 32

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 33

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 33

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 34

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 34

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 35

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 35

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 36

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 36

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 37

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 37

Notice: Undefined variable: stok_ch_open in /home/slasher/public_html/stockpile.php on line 39

Notice: Undefined variable: do_transaction in /home/slasher/public_html/stockpile.php on line 50

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 173

Notice: Undefined variable: officer in /home/slasher/public_html/stockpile.php on line 184

Notice: Use of undefined constant granary - assumed 'granary' in /home/slasher/public_html/stockpile.php on line 188

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 188

Notice: Use of undefined constant loft - assumed 'loft' in /home/slasher/public_html/stockpile.php on line 189

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 189

Notice: Use of undefined constant stockpile - assumed 'stockpile' in /home/slasher/public_html/stockpile.php on line 190

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 190

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 191

Notice: Undefined variable: transaction in /home/slasher/public_html/stockpile.php on line 193
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

Another thing... Is it possible to take the cap off troops?
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
Fresh Water Fighters
Legendary River Dog
Posts: 838
Joined: Sat Mar 20, 2004 1:07 pm
Location: Thialand (But I come form New Zealand)

Post by Fresh Water Fighters »

Slasher you have an insane turns rate...
*laughs*
User avatar
purekilla2k
Crazy Killa Arms Dealer
Posts: 318
Joined: Thu Jul 14, 2005 11:27 pm

Post by purekilla2k »

insane is his survivor server <_<
www.exius-ent.com/forums
Gaming Elder www.mapleglobal.com
Eternal Protector Of Redwall
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

oii naughty people they were way off topic *laughs*...


anyway new code:

code: Select all

<?
error_reporting(E_ALL); 
include("header.php");

// Find the total net of stockpile.

$totalnet = sqleval("SELECT sum(networth) FROM $playerdb WHERE land>0 AND disabled != 2 AND stockpile=$users[stockpile];");

// Limits

$limit_food = 1000000000;
$limit_cash = 1000000000;
$limit_rune = 1000000000;

$show_limit_food = $limit_food;
$show_limit_cash = $limit_cash;
$show_limit_rune = $limit_rune;

if($limit_food < $stockpile['granary'])
	$limit_food = $stockpile[granary];
if($limit_cash < $stockpile['stockpile'])
	$limit_cash = $stockpile[stockpile];
if($limit_rune < $stockpile['loft'])
	$limit_rune = $stockpile[loft];

$ucglimit = min($users[cash], $limit_cash-$stockpile['stockpile']);
$ufglimit = min($users[food], $limit_food-$stockpile['granary']);
$urglimit = min($users[runes], $limit_rune-$stockpile['loft']);
$uctlimit = $stockpile['stockpile'];
$uftlimit = $stockpile['granary'];
$urtlimit = $stockpile['loft'];

if($stok_ch_open) {
	$stok = $stockpile['stok_open'];
	if($stok)
  $stok = 0;
	else
  $stok = 1;
	$stockpile['stok_open'] = $stok;
	savestockpileData($stockpile, "stok_open");
}


if($do_transaction) {
	// Fix our Input(s)
//echo "Cash T: $cash_take";

	fixInputNum($food_take);
	fixInputNum($food_give);

	fixInputNum($rune_take);
	fixInputNum($rune_give);

	fixInputNum($cash_take);
	fixInputNum($cash_give);

//echo "Cash T: $cash_take";

	if(!empty($_POST['ctmax']))  $cash_take = $uctlimit;
	if(!empty($_POST['ftmax']))  $food_take = $uftlimit;
	if(!empty($_POST['rtmax']))  $rune_take = $urtlimit;
	if(!empty($_POST['cgmax']))  $cash_give = $ucglimit;
	if(!empty($_POST['fgmax']))  $food_give = $ufglimit;
	if(!empty($_POST['rgmax']))  $rune_give = $urglimit;


	if($cash_give - $cash_take == 0 &&
    $food_give - $food_take == 0 &&
    $rune_give - $rune_take == 0)
  TheEnd("You're not doing anything in that transaction!");


	// Negative number?
	if($cash_take < 0 || $cash_give < 0 || $rune_take < 0 || $rune_give < 0 || $food_take < 0 || $food_give < 0)
  TheEnd("You may not take or give a negative amount");

	// Giving too much?
	if($cash_give > $users[cash] || $rune_give > $users[runes] || $food_give > $users[food])
  TheEnd("You don't have enough to deposit");

	// Taking too much?
	if($cash_take > $stockpile['stockpile'] || $rune_take > $stockpile['loft'] || $food_take > $stockpile['granary'])
  TheEnd("You can't take that much.");

	// Give to user

	$users[food] += $food_take;
	$stockpile[granary] -= $food_take;

	$users[cash] += $cash_take;
	$stockpile[stockpile] -= $cash_take;

	$users[runes] += $rune_take;
	$stockpile[loft] -= $rune_take;


	// Give to stockpile

	$users[food] -= $food_give;
	$stockpile[granary] += $food_give;

	$users[cash] -= $cash_give;
	$stockpile[stockpile] += $cash_give;

	$users[runes] -= $rune_give;
	$stockpile[loft] += $rune_give;


	// Safety checks... incase I've missed it somewhere else
	if($stockpile[loft] < 0 || $stockpile[stockpile] < 0 || $stockpile[granary] < 0)
  TheEnd("You can't take that much.");

	if($users[runes] < 0 || $users[cash] < 0 || $users[food] < 0)
  TheEnd("You can't give that much.");


	// Over the limit?
	if($stockpile[granary] > $limit_food || $stockpile[stockpile] > $limit_cash || $stockpile[loft] > $limit_rune)
  TheEnd("You can't give that much.");


	if($stockpile['stok_open'] == 0 && $officer == 0) {
  if($cash_take > 0 || $rune_take > 0 || $food_take > 0)
  	TheEnd("Sorry, only the stockpile officers may take from the stockpile stockpile at this time!");
	}


	// Save up data

	saveUserDataNet($users, "food cash runes networth");
	saveUserData($users, "granary loft treasury");

	// Output

	$transaction = "";

	if($cash_give > 0) $transaction .= "Gave \$" . commas($cash_give) . ". \n<br>";
	if($cash_take > 0) $transaction .= "Took \$" . commas($cash_take) . ". \n<br>";

	if($food_give > 0) $transaction .= "Gave " . commas($food_give) . " food. \n<br>";
	if($food_take > 0) $transaction .= "Took " . commas($food_take) . " food. \n<br>";

	if($rune_give > 0) $transaction .= "Gave " . commas($rune_give) . " runes. \n<br>";
	if($rune_take > 0) $transaction .= "Took " . commas($rune_take) . " runes. \n<br>";

	{
  if($member[num] != $users[num] )
  	addNews(501, array(stockpile1=>$users[stockpile], id1=>$member[num], id2=>$users[num],	food1=>($food_give-$food_take),
            	cash1=>($cash_give-$cash_take),
            	runes1=>($rune_give-$rune_take)));
    //News to members
  if($member[num] == $users[num] )
  	addNews(502, array(stockpile1=>$users[stockpile], id1=>$users[num],  	food1=>($food_give-$food_take),
            	cash1=>($cash_give-$cash_take),
            	runes1=>($rune_give-$rune_take)));
	
    //News to self
	}

	$tpl->assign("trans", $transaction);

	// Send to stockpile leader? Store in table?
}

$co = 'Open';
$nco = 'Open';
if($stockpile['stok_open']) {
	$co = 'Open';
	$nco = 'Open';
}

// Assign to template.

$tpl->assign('limit_food', commas($show_limit_food));
$tpl->assign('limit_rune', commas($show_limit_rune));
$tpl->assign('limit_cash', commas($show_limit_cash));

$tpl->assign('officer', $officer);
$tpl->assign('stok_open', $co);
$tpl->assign('nco', $nco);

$tpl->assign('curr_food', commas($stockpile['granary']));
$tpl->assign('curr_rune', commas($stockpile['loft']));
$tpl->assign('curr_cash', commas($stockpile['stockpile']));
$tpl->assign('stockpile_name', $stockpile['name']);

if($transaction != "") $tpl->assign('trans', $transaction);

$tpl->display('stockpile.html');

echo "<hr>";
include("stok-news.php");

TheEnd('');
?>
errors
Notice: Undefined index: stockpile in /home/slasher/public_html/stockpile.php on line 7

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 19

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 21

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 23

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 26

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 27

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 28

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 29

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 30

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 31

Notice: Undefined variable: stok_ch_open in /home/slasher/public_html/stockpile.php on line 33

Notice: Undefined variable: do_transaction in /home/slasher/public_html/stockpile.php on line 44

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 167

Notice: Undefined variable: officer in /home/slasher/public_html/stockpile.php on line 178

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 182

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 183

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 184

Notice: Uninitialized string offset: 0 in /home/slasher/public_html/stockpile.php on line 185

Notice: Undefined variable: do_transaction in /home/slasher/public_html/stockpile.php on line 187
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
Fresh Water Fighters
Legendary River Dog
Posts: 838
Joined: Sat Mar 20, 2004 1:07 pm
Location: Thialand (But I come form New Zealand)

Post by Fresh Water Fighters »

try slowing down your game to a speed the server can handle...
*laughs*
jk jk
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

it can handle 20,000 turns at once
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
Fresh Water Fighters
Legendary River Dog
Posts: 838
Joined: Sat Mar 20, 2004 1:07 pm
Location: Thialand (But I come form New Zealand)

Post by Fresh Water Fighters »

*trys to run 20,001 turns at once*
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

did it work? *laughs*
I do not have a signature, you must be imagining

http://florida4us.com/

Image
Post Reply
  • Members connected in real time

    🔒 Close the panel of connected members