<?php
$defaultEffects = mysql_fetch_assoc(mysql_query("SELECT id, name FROM effects WHERE type = 9994 AND owner = " . $user['id'] . " ORDER BY id DESC"));
$chaosEffects = mysql_fetch_array(mysql_query('SELECT * FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $user['laba'] . '" AND `time` > "'.time().'" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1'));
if ($defaultEffects) {
    global $nodrink;
    if (in_array($user["room"],$nodrink)) {
		echo "Р—РґРµСЃСЊ Р·Р°РїСЂРµС‰РµРЅРѕ РїРёС‚СЊ СЌР»РёРєСЃРёСЂС‹!";
    } elseif ($user['battle'] > 0) {
		echo "РќРµ РІ Р±РѕСЋ...";               
    } else {
		mysql_query('DELETE FROM effects WHERE id = ' . $defaultEffects['id']);
		echo "Р’С‹ СѓСЃРїРµС€РЅРѕ РІС‹Р»РµС‡РµРЅС‹ РѕС‚ СЏРґР° " . $defaultEffects['name'];
		addchp ('<font color=red>Р’РЅРёРјР°РЅРёРµ!</font> Р’С‹ СѓСЃРїРµС€РЅРѕ РІС‹Р»РµС‡РµРЅС‹ РѕС‚ СЏРґР° <b>' . $defaultEffects['name'] . '</b>', '{[]}'.$user['login'].'{[]}');
		$bet=1;
    }
} else if ($chaosEffects) {
	if ($user['battle'] > 0) {
		echo "РќРµ РІ Р±РѕСЋ...";               
    } else {
		mysql_query('DELETE FROM `laba_act` WHERE `id` = "'.$chaosEffects['id'].'"');
		echo "Р’С‹ СѓСЃРїРµС€РЅРѕ СЃРЅСЏР»Рё РїСѓС‚С‹";
		addchp ('<font color=red>Р’РЅРёРјР°РЅРёРµ!</font> Р’С‹ СѓСЃРїРµС€РЅРѕ СЃРЅСЏР»Рё РїСѓС‚С‹', '{[]}'.$user['login'].'{[]}');
		$bet=1;
    }
} else {
    echo "Р’С‹ РЅРµ РѕС‚СЂР°РІР»РµРЅС‹";
}