本文整理汇总了PHP中put_error函数的典型用法代码示例。如果您正苦于以下问题:PHP put_error函数的具体用法?PHP put_error怎么用?PHP put_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rem_sc_from_book
function rem_sc_from_book($spell, $book, $login)
{
// v has_item proveritsja
//$spell = preg_replace ('/[^a-z0-9_\.]/i', '', $spell);
//$book = preg_replace ('/[^a-z0-9_\.]/i', '', $book);
//$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
include_once 'modules/f_has_item.php';
if (!has_item($book, $login)) {
put_g_error('у вас нету книги');
}
// zapros na magiju chto v knige:
$q = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $book . "' AND type = 'b';");
if (!mysql_num_rows($q)) {
return 0;
}
$magic = mysql_result($q, 0);
if (strpos($magic, $spell) === false) {
put_g_error('в этой книге нету этого заклинания!');
}
// esli prodolzhaetsja skript, znachit magija estq, izvlekem ee (snachala udalim, togda bagov skryvatq nebvudut:)
$magic = string_drop($magic, $spell);
// terq sozdadim:
//include_once ('modules/f_create_item.php');
$q = do_mysql("SELECT type FROM magic WHERE fullname = '" . $spell . "';");
if (!mysql_num_rows($q)) {
put_error('netu takogo zaklinanija');
}
$tp = mysql_result($q, 0);
//#####$scroll = create_item ('i.s.'.$tp.'.'.$spell);
include_once 'modules/f_gain_item.php';
gain_item('i.s.' . $tp . '.' . $spell, 1, $login);
// obnovim knigu i vse:
do_mysql("UPDATE items SET on_take = '" . $magic . "' WHERE fullname = '" . $book . "';");
return 1;
}
示例2: upd_last_cast
function upd_last_cast($pl, $spell)
{
//$pl = preg_replace ('/[^a-z0-9_]/i', '', $pl);
//$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
$now = time();
$id = is_player($pl);
if (!$id) {
put_error('npc cant cast spell');
}
$q = do_mysql("SELECT last FROM players WHERE id_player = '" . $id . "';");
$last = mysql_result($q, 0);
$last = explode('|', $last);
// vremja zaklinanija:
$q = do_mysql("SELECT timewait FROM magic WHERE fullname = '" . $spell . "';");
if (!mysql_num_rows($q)) {
put_error('there are no such spell: ' . $spell . '');
}
$tw = mysql_result($q, 0);
$last[3] = $now + $tw;
// obrabotka effektami:
#include_once ('modules/f_get_affected.php');
// effecty:
#$aff = get_affected ($LOGIN);
// primer: if (is_in ('oglushen', $aff)) $last[3] += 10;
$nlast = $last[0] . '|' . $last[1] . '|' . $last[2] . '|' . $last[3] . '|' . $last[4] . '|' . $last[5] . '|' . $last[6] . '|' . $last[7] . '|' . $last[8];
do_mysql("UPDATE players SET last = '" . $nlast . "' WHERE id_player = '" . $id . "';");
return 1;
}
示例3: set_w_effects
function set_w_effects($weapon, $dmg_type, $name)
{
//$weapon = preg_replace ('/[^a-z0-9_\.]/', '', $weapon);
//$name = preg_replace ('/[^a-z0-9_\.]/', '', $name);
if (!$weapon) {
return 0;
}
$q = do_mysql("SELECT on_drop FROM items WHERE fullname = '" . $weapon . "';");
if (!mysql_num_rows($q)) {
put_error('ner to weapo');
}
$effs = mysql_result($q, 0);
$effs = explode('|', $effs);
$c = count($effs);
for ($i = 0; $i < $c; $i++) {
if (rand(0, 100) <= 30) {
include_once 'modules/f_set_affected.php';
set_affected($name, $effs[$i]);
}
}
// otdelqnyj razgovor s oglusheniem
if ($dmg_type == 'drob') {
if (rand(0, 100) <= 30) {
include_once 'modules/f_set_affected.php';
set_affected($name, 'oglushen');
}
}
return 1;
}
示例4: do_mysql
function do_mysql($query, $return = 0)
{
$query = mysql_real_escape_string($query);
$this->a = mysql_query($query, $this->dbcnx);
if (!$this->a) {
put_error('error in mysql: the query was: "' . $query . '"');
}
if ($return == 2) {
// returning associative masive
while ($this->ret = mysql_fetch_assoc($this->a)) {
return $this->ret;
}
} else {
if ($return == 1) {
// returning one element, or empty
if (!mysql_num_rows($this->a)) {
return '';
}
$this->ret = mysql_result($this->a, 0);
return $this->ret;
} else {
// simply returns connection descriptor:
return $this->a;
}
}
}
示例5: learn_skill
function learn_skill($skill, $price)
{
global $p;
global $sid;
$skill = preg_replace('/[^0-9]/', '', $skill);
$price = preg_replace('/[^0-9]/', '', $price);
if ($skill === false) {
put_error('неуказан навык');
}
if ($price === false) {
put_error('неуказанa цена');
}
if (!isset($p['skills'][$skill])) {
put_error('такого навыка нету');
}
if ($p['skills'][$skill]) {
put_g_error('вы уже имеете этот навык!');
}
$mage = array(22, 23, 24, 25, 26, 27, 28, 29, 30);
$warrior = array(7, 8, 9, 10, 41);
$ranger = array(11, 12);
// proverka na klassy:
if ($p['classof'] != 3 && in_array($skill, $mage)) {
put_g_error('только для магов!');
}
if ($p['classof'] != 1 && in_array($skill, $warrior)) {
put_g_error('только для воина!');
}
if ($p['classof'] != 2 && in_array($skill, $ranger)) {
put_g_error('только для лучников!');
}
if ($p['money'] < $price) {
put_g_error('у вас нехватает серебра - надо ' . $price . ' монет!');
}
if (!$p['stats'][3]) {
put_g_error('у вас нету очка навыка!');
}
// nelzja vychitq vtoroj navyk iz serii parirovanie - dvuruchnoe - dva
if (($p['skills'][18] || $p['skills'][40] || $p['skills'][41]) && ($skill == 18 || $skill == 40 || $skill == 41)) {
put_g_error('нелзя выучить два навыка из серии двуручное - два - парирование. Либо щит, либо двуручное, либо два.');
}
// esli vsju proverku proshli, podnimem i zabudem
$p['skills'][$skill] = 1;
$p['stats'][3] -= 1;
$skills = implode('|', $p['skills']);
$stats = implode('|', $p['stats']);
$p['money'] -= $price;
do_mysql("UPDATE players SET skills = '" . $skills . "', stats = '" . $stats . "', money = '" . $p['money'] . "' WHERE id_player = '" . $p['id_player'] . "';");
$f = gen_header('навыки');
$f .= '<div class="y" id="sodhg"><b>навыки:</b></div><p>';
include 'modules/sp/sp_skillnames.php';
$f .= 'вы выучили ' . $skn[$skill] . '!<br/>';
$f .= '<a class="blue" href="game.php?sid=' . $sid . '">в игру</a></p>';
$f .= gen_footer();
exit($f);
}
示例6: get_dead_info
function get_dead_info($dead)
{
//$dead = preg_replace ('/[^a-z0-9\.]/i', '', $dead);
if (substr($dead, 0, 2) != 'd.') {
put_error('это не труп');
}
$q = do_mysql("SELECT * FROM dead WHERE fullname = '" . $dead . "';");
$d = mysql_fetch_assoc($q);
$d['l_hunt'] = $d['hunt'];
$d['hunt'] = explode('|', $d['hunt']);
return $d;
}
示例7: can_reach
function can_reach($from, $to, $depth)
{
$map = substr($from, 0, 4);
if ($map != substr($to, 0, 4)) {
put_error('raznye karty');
}
include 'modules/loc/' . $map . '.php';
$fromi = substr($from, 5);
$toi = substr($to, 5);
if (!isset($l[$fromi]) || !isset($l[$toi])) {
put_error('нет таких лок');
}
}
示例8: gain_item
function gain_item($item, $count, $login)
{
global $I_SEP_C, $p;
//$item = preg_replace ('/[^a-z0-9\._]/i', '', $item);
$count = preg_replace('/[^0-9]/', '', $count);
//$login = preg_replace ('/[^a-z0-9_]/', '', $login);
if (!$item || !$count || !$login) {
put_error('заполните усе данные (это к админу)');
}
$id = is_player($login);
include_once 'modules/f_create_item.php';
include_once 'modules/f_add_item_to_pl.php';
include_once 'modules/f_add_item_to_loc.php';
include_once 'modules/f_get_it_name.php';
if (substr($item, 2, 1) == 'm') {
$nitem = create_item($item);
//add_item_to_pl ($login, $nitem);
$name = get_it_name($nitem);
$q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $login . "' AND is_in = 'inv' AND weight > 0;");
$c = mysql_result($q, 0);
if ($c > $I_SEP_C) {
add_item_to_loc($p['location'], $nitem);
} else {
$q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $login . "' AND is_in = 'inv' AND realname = '" . $item . "';");
if (mysql_num_rows($q)) {
$fn = mysql_result($q, 0);
do_mysql("UPDATE items SET on_take = on_take + " . $count . " WHERE fullname = '" . $fn . "';");
do_mysql("DELETE FROM items WHERE fullname = '" . $nitem . "';");
} else {
add_item_to_pl($login, $nitem);
do_mysql("UPDATE items SET on_take = '" . $count . "' WHERE fullname = '" . $nitem . "';");
}
}
add_journal('вы получили ' . $name . '!', $login);
} else {
for ($i = 0; $i < $count; $i++) {
$nitem = create_item($item);
$name = get_it_name($nitem);
$q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $login . "' AND is_in = 'inv' AND weight > 0;");
$c = mysql_result($q, 0);
if ($c > $I_SEP_C) {
add_item_to_loc($p['location'], $nitem);
} else {
add_item_to_pl($login, $nitem);
}
add_journal('вы получили ' . $name . '!', $login);
}
}
return $nitem;
}
示例9: trade_param
function trade_param($item)
{
$item = preg_replace('/[^a-z0-9\\._]/i', '', $item);
$cl = substr($item, 2, 1);
$tp = substr($item, 4, 3);
if (!file_exists('modules/items/items_' . $cl . '/items_' . $cl . '_' . $tp . '.php')) {
put_error('<p>нету такого файла для создания веши: modules/items/items_' . $cl . '/items_' . $cl . '_' . $tp . '.php</p>');
}
include 'modules/items/items_' . $cl . '/items_' . $cl . '_' . $tp . '.php';
if (!isset($it[$item])) {
put_error('<p>такой веши нету в файлах: ' . $item . '</p>');
}
$it[$item] = explode('|', $it[$item]);
return $it[$item];
}
示例10: check_last_cast
function check_last_cast($pl)
{
//$pl = preg_replace ('/[^a-z0-9_\.]/i', '', $pl);
$now = time();
$id = is_player($pl);
if (!$id) {
// pokachtoo zhivotnye ne kastujut:
put_error('npc cant cast');
}
$q = do_mysql("SELECT last FROM players WHERE id_player = '" . $id . "';");
$a = mysql_fetch_assoc($q);
$last = $a['last'];
$last = explode('|', $last);
// v magii pri obnovlenii ukazyvaetsja vremja, sejchas nado tolqko proveritq, nastupilo li
if ($last[3] < $now) {
return 1;
}
return 0;
}
示例11: get_max_str
function get_max_str($item)
{
global $I_P_P;
global $I_P_J;
$pref = substr($item, 8, 3);
$q = do_mysql("SELECT jewel FROM items WHERE fullname = '" . $item . "';");
if (!mysql_num_rows($q)) {
put_error('вешь не существует: ' . $item);
}
$jewel = mysql_result($q, 0);
$str = $I_P_P[$pref];
if (isset($I_P_J[$jewel])) {
$str = round($str * $I_P_J[$jewel]);
}
//$q = do_mysql ("SELECT maxduraminus FROM items WHERE fullname = '".$item."';");
//$mdm = mysql_result ($q, 0);
//$str -= $mdm;
return $str;
}
示例12: delete_count
function delete_count($item, $count, $login)
{
//$item = preg_replace ('/[^a-z0-9\._]/i', '', $item);
$count = preg_replace('/[^0-9]/', '', $count);
//$login = preg_replace ('/[^a-z0-9_]/', '', $login);
if (!$item || !$count || !$login) {
put_error('заполните усе данные (это к админу): ' . $item . ', ' . $count . ', ' . $login);
}
$i = 1;
$q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $login . "' AND is_in <> 'ban' AND type <> 'm' AND realname LIKE '" . $item . "%';");
while ($it = mysql_fetch_assoc($q)) {
if ($i > $count) {
break;
}
do_mysql("DELETE FROM items WHERE fullname = '" . $it['fullname'] . "';");
$i++;
}
return $i - 1;
}
示例13: add_item_to_pl
function add_item_to_pl($pl, $item)
{
//$item = preg_replace ('/[^a-z\._0-9]/i', '', $item);
//$pl = preg_replace ('/[^a-z\._0-9]/i', '', $pl);
$t = substr($item, 2, 1);
if ($t == 'o' || $t == 'l') {
put_error('ne te veshi, pane!');
}
//require_once ("modules/f_get_weight.php");
// kolichestvo:
$q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $pl . "' AND is_in = 'inv' AND weight > 0;");
$c = mysql_result($q, 0);
global $I_SEP_C;
if ($c > $I_SEP_C) {
put_g_error('в рюгзаке нехватает места');
}
// add_journal ('[green]'.$item.' to '.$pl.'[/end]', 'maxx');
do_mysql("UPDATE items SET belongs = '" . $pl . "', location = '0', map = '', is_in = 'inv' WHERE fullname = '" . $item . "';");
return 1;
}
示例14: has_count
function has_count($item, $count, $login)
{
//$item = preg_replace ('/[^a-z0-9\._]/i', '', $item);
$count = preg_replace('/[^0-9]/', '', $count);
//$login = preg_replace ('/[^a-z0-9_]/', '', $login);
if (!$item || !$count || !$login) {
put_error('заполните усе данные (это к админу)');
}
$q = do_mysql("SELECT COUNT(*) FROM items WHERE realname LIKE '" . $item . "%' AND belongs = '" . $login . "' AND is_in <> 'ban';");
$has = mysql_result($q, 0);
if ($has == 0) {
return 0;
}
if ($has < $count) {
return -1;
}
if ($has >= $count) {
return 1;
}
}
示例15: create_item_m
function create_item_m($fullname, $count)
{
//$fullname = preg_replace ('/[^a-z0-9_\.]/i', '', $fullname);
//$count = preg_replace ('/[^0-9]/', '', $count);
// v princype v etu funkciju iz faila vvodjatsja vse dannye
// klass:
$cl = substr($fullname, 2, 1);
// tip
$tp = substr($fullname, 4, 3);
// podkljuchim
//echo $fullname;
if (!file_exists('modules/items/items_' . $cl . '/items_' . $cl . '_' . $tp . '.php')) {
put_error('<p>нету такого файла для создания веши: modules/items/items_' . $cl . '/items_' . $cl . '_' . $tp . '.php</p>');
}
include 'modules/items/items_' . $cl . '/items_' . $cl . '_' . $tp . '.php';
if (!isset($it[$fullname])) {
put_error('<p>такой веши нету в файлах: ' . $fullname . '</p>');
}
$it[$fullname] = explode('|', $it[$fullname]);
// edinstvennoe chto nado sdelatq - eto izmenitq fullname
// poetomu, zapolnim za dva raza, pervyj raz ukazhem lozhnyj fullname
$name = mysql_real_escape_string($it[$fullname][0]);
$fullname = mysql_real_escape_string($it[$fullname][1]);
$type = mysql_real_escape_string($it[$fullname][2]);
$on_take = mysql_real_escape_string($count);
$on_use = mysql_real_escape_string($it[$fullname][4]);
$on_drop = mysql_real_escape_string($it[$fullname][5]);
$price = mysql_real_escape_string($it[$fullname][6]);
$dmg = mysql_real_escape_string($it[$fullname][7]);
$armor = mysql_real_escape_string($it[$fullname][8]);
$weight = mysql_real_escape_string($it[$fullname][11]);
do_mysql("INSERT INTO items VALUES (0, '" . $name . "', '" . $fullname . ".i', '" . $type . "', '" . $on_take . "', '" . $on_use . "', '" . $on_drop . "', '" . $price . "', '" . $dmg . "', '" . $armor . "', '', '', '" . $weight . "', '', '" . $fullname . "', '', '', '0', '0', '0');");
// teperq vozqmem id_item i pripishem ego k fullname
$a = do_mysql("SELECT id_item FROM items WHERE fullname = '" . $fullname . ".i';");
$id_item = mysql_result($a, 0);
// obnovim
do_mysql("UPDATE items SET fullname = '" . $fullname . "." . $id_item . "' WHERE fullname = '" . $fullname . ".i';");
return $fullname . '.' . $id_item;
}