当前位置: 首页>>代码示例>>PHP>>正文


PHP put_g_error函数代码示例

本文整理汇总了PHP中put_g_error函数的典型用法代码示例。如果您正苦于以下问题:PHP put_g_error函数的具体用法?PHP put_g_error怎么用?PHP put_g_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了put_g_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: teach_magic_from_sc

function teach_magic_from_sc($scroll, $npc, $login)
{
    //$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
    //$npc = preg_replace ('/[^a-z0-9_\.]/i', '', $npc);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $nid = is_npc($npc);
    $id = is_player($login);
    // v odnoj li lokacii
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc1 = mysql_result($q, 0);
    $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc2 = mysql_result($q, 0);
    if ($loc1 != $loc2) {
        return 0;
    }
    include_once 'modules/f_has_item.php';
    if (!has_item($scroll, $login)) {
        put_g_error('у вас нету свитка!');
    }
    $q = do_mysql("SELECT on_take, price FROM items WHERE fullname = '" . $scroll . "' AND type = 's';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $spell = mysql_fetch_assoc($q);
    // neumeet li on uzhe
    include_once 'modules/f_has_magic.php';
    if (has_magic($spell['on_take'], $login)) {
        put_g_error('вы уже умеете это заклинание!');
    }
    // cenu vyschitaem:
    $q = do_mysql("SELECT money FROM players WHERE id_player = '" . $id . "';");
    $money = mysql_result($q, 0);
    $cost = $spell['price'] * 10;
    if ($money < $cost) {
        put_g_error('нехватает серебра, нужно ' . $cost . ' серебреных!');
    }
    $money -= $cost;
    // dobavljaem zakl:
    $q = do_mysql("SELECT magic FROM players WHERE id_player = '" . $id . "';");
    $magic = mysql_result($q, 0);
    if (!$magic) {
        $magic = $spell['on_take'];
    } else {
        $magic .= '|' . $spell['on_take'];
    }
    // obnovim dannye:
    do_mysql("UPDATE players SET magic = '" . $magic . "', money = '" . $money . "' WHERE id_player = '" . $id . "';");
    // udaljaem svitok
    include_once 'modules/f_delete_item.php';
    delete_item($scroll);
    $q = do_mysql("SELECT name FROM magic WHERE fullname = '" . $spell['on_take'] . "';");
    $name = mysql_result($q, 0);
    exit_msg('магия', 'вы выучили заклинание ' . $name . ' за ' . $cost . ' серебреных!');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:60,代码来源:f_teach_magic_from_sc.php

示例2: 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;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:35,代码来源:f_rem_sc_from_book.php

示例3: 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);
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:56,代码来源:f_learn_skill.php

示例4: add_sc_to_book

function add_sc_to_book($scroll, $book, $login)
{
    // v has_item proveritsja
    //$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
    //$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($scroll, $login)) {
        put_g_error('у вас нету свитка');
    }
    if (!has_item($book, $login)) {
        put_g_error('у вас нету книги');
    }
    // tolqko esli estq navyk:
    $q = do_mysql("SELECT skills FROM players WHERE login = '" . $login . "';");
    $skills = mysql_result($q, 0);
    $skills = explode('|', $skills);
    if (!$skills[30]) {
        put_g_error('у вас нету навыка');
    }
    // dobavim:
    $q = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $book . "' AND type = 'b';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $mlist = mysql_result($q, 0);
    $q = do_mysql("SELECT on_take FROM items WHERE type = 's' AND fullname = '" . $scroll . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $spell = mysql_result($q, 0);
    if (strpos($mlist, $spell) !== false) {
        put_g_error('в этой книге уже есть это заклинание!');
    }
    if ($mlist) {
        $mlist .= '~' . $spell;
    } else {
        $mlist = $spell;
    }
    do_mysql("UPDATE items SET on_take = '" . $mlist . "' WHERE fullname = '" . $book . "';");
    // udalim svitok:
    include_once 'modules/f_delete_item.php';
    delete_item($scroll);
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:45,代码来源:f_add_sc_to_book.php

示例5: mag_summon

function mag_summon($spell, $login)
{
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $id = is_player($login);
    $q = do_mysql("SELECT cname FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $fullname = mysql_result($q, 0);
    if (!$fullname) {
        return 0;
    }
    // zapros na lokaciju igroka i kolichestvo priruchennyh zhivotnyh
    $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc = mysql_result($q, 0);
    $q = do_mysql("SELECT COUNT(*) FROM npc WHERE belongs = '" . $login . "';");
    $c = mysql_result($q, 0);
    if ($c > 0) {
        put_g_error('у вас уже есть нпц, принадлежащие вам');
    }
    // sozdaem npc:
    include_once 'modules/f_create_npc.php';
    $npc = create_npc($fullname, substr($loc, 0, 4), $loc);
    $nid = is_npc($npc);
    // izmenim imja:
    $q = do_mysql("SELECT name FROM npc WHERE id_npc = '" . $nid . "';");
    $name = mysql_result($q, 0);
    $nname = 'призванный ' . $name;
    $fullname = $npc . '.' . $login;
    // ataka:
    $q = do_mysql("SELECT in_battle FROM players WHERE id_player = '" . $id . "';");
    $inb = mysql_result($q, 0);
    do_mysql("UPDATE npc SET fullname = '" . $fullname . "', name = '" . $nname . "', belongs = '" . $login . "', move = '30', in_battle = '" . $inb . "', type = 'a' WHERE id_npc = '" . $nid . "';");
    $q = do_mysql("SELECT name FROM players WHERE id_player = '" . $id . "';");
    $pn = mysql_result($q, 0);
    add_journal($pn . ': призвал ' . $name . '!', 'l.' . $loc);
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:42,代码来源:f_mag_summon.php

示例6: 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;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:20,代码来源:f_add_item_to_pl.php

示例7: check_in_has

function check_in_has($item)
{
    global $LOGIN;
    global $p;
    if (strpos($item, '|')) {
        $has = -1;
        $item = explode('|', $item);
        $c = count($item);
        for ($i = 0; $i < $c; $i++) {
            if (has_count($item[$i], 1, $LOGIN)) {
                $has = $i;
            }
        }
        if ($has == -1) {
            put_g_error('нехватает ингридиентов');
        }
        //for ($i = 0; $i < $c; $i++)
        //{
        $t = substr($item[$has], 8, 1);
        if ($t == 1 && $p['skills'][32] < 1 || $t == '2' && $p['skills'][32] < 5 || $t == '3' && $p['skills'][32] < 10 || $t == 4 && $p['skills'][32] < 15) {
            put_g_error('нехватает навыка пользоватся вешью');
        }
        if ($t > 0 && $t < 5) {
            $qp += $t;
        }
        //}
    } else {
        $t = substr($item, 8, 1);
        if ($t == 1 && $p['skills'][32] < 1 || $t == '2' && $p['skills'][32] < 5 || $t == '3' && $p['skills'][32] < 10 || $t == 4 && $p['skills'][32] < 15) {
            put_g_error('нехватает навыка пользоватся вешью');
        }
        if ($t > 0 && $t < 5) {
            $qp += $t;
        }
        if (!has_count($item, 1, $LOGIN)) {
            put_g_error('нехватает ингридиентов');
        }
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:40,代码来源:sp_alchemy.php

示例8: check_in_has

function check_in_has($item)
{
    global $LOGIN;
    if (strpos($item, '|')) {
        $has = 0;
        $item = explode('|', $item);
        $c = count($item);
        for ($i = 0; $i < $c; $i++) {
            if (has_count($item[$i], 1, $LOGIN)) {
                $has = 1;
            }
        }
        if (!$has) {
            put_g_error('нехватает ингридиентов');
        }
    } else {
        if (!has_count($item, 1, $LOGIN)) {
            put_g_error('нехватает ингридиентов');
        }
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:22,代码来源:sp_cooking.php

示例9: repair_item

function repair_item($item, $login, $self = 0)
{
    include_once 'modules/f_get_max_str.php';
    $strm = get_max_str($item);
    if (!$strm) {
        $strm = 1;
    }
    $q = do_mysql("SELECT str, price FROM items WHERE fullname = '" . $item . "' AND belongs = '" . $login . "';");
    if (!mysql_num_rows($q)) {
        put_error('нема вещи ' . $item);
    }
    $i = mysql_fetch_assoc($q);
    if (!$self) {
        $id = is_player($login);
        $q = do_mysql("SELECT money FROM players WHERE id_player = '" . $id . "'");
        $money = mysql_result($q, 0);
        if (!$i['str']) {
            $i['str'] = 1;
        }
        $cost = round($i['price'] * $i['str'] / $strm);
        if ($money < $cost) {
            put_g_error('нехватает серебра, надо ' . $cost);
        }
        $money -= $cost;
        do_mysql("UPDATE players SET money = '" . $money . "' WHERE id_player = '" . $id . "';");
    } else {
        // chinim samostojatelqno, self navyk
        $cost = $self * 20;
        $i['str'] += $cost;
        if ($i['str'] < $strm) {
            $strm = $i['str'];
        }
    }
    do_mysql("UPDATE items SET str = '" . $strm . "' WHERE fullname = '" . $item . "';");
    return $cost;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:36,代码来源:f_repair_item.php

示例10: drop_item

function drop_item($item, $login)
{
    //$item = preg_replace ('/[^a-z0-9\._]/i', '', $item);
    //$login = mysql_real_escape_string ($login);
    $id = is_player($login);
    $q = do_mysql("SELECT name FROM items WHERE belongs = '" . $login . "' AND is_in <> 'ban' AND fullname = '" . $item . "';");
    if (!mysql_num_rows($q)) {
        put_g_error('у вас нету этой вещи');
    }
    $name = mysql_result($q, 0);
    // raz vse estq, vykinem v lokaciju.
    $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    $loc = mysql_result($q, 0);
    include_once 'modules/f_add_item_to_loc.php';
    add_item_to_loc($loc, $item);
    $q = do_mysql("SELECT gender, name FROM players WHERE id_player = '" . $id . "';");
    $p = mysql_fetch_assoc($q);
    if ($p['gender'] == 'male') {
        $text = $p['name'] . ' 6poccul';
    } else {
        $text = $p['name'] . ' 6poccula';
    }
    add_journal($text . ' ' . $name . '!', 'l.' . $loc);
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:24,代码来源:f_drop_item.php

示例11: mag_decl_attack

function mag_decl_attack($who, $to)
{
    // po idee magiej npc napadatq nebudut, no na vsjakij pozharnyj i tak puwu:
    //$who = preg_replace ('/[^a-z0-9_\.]/i', '', $who);
    //$to = preg_replace ('/[^a-z0-9_\.]/i', '', $to);
    if ($to == $who) {
        put_g_error('на себя напасть нелзя!');
    }
    $id = is_player($who);
    $n = 0;
    if ($id) {
        $q = do_mysql("SELECT in_battle, status1, location, last FROM players WHERE id_player = '" . $id . "';");
    } else {
        $id = is_npc($who);
        $n = 1;
        $q = do_mysql("SELECT in_battle, location FROM npc WHERE id_npc = '" . $id . "';");
    }
    $w_inf = mysql_fetch_assoc($q);
    $tid = is_player($to);
    $tn = 0;
    if ($tid) {
        $q = do_mysql("SELECT in_battle, status1, location FROM players WHERE id_player = '" . $tid . "';");
    } else {
        $tid = is_npc($to);
        $tn = 1;
        $q = do_mysql("SELECT in_battle, location FROM npc WHERE id_npc = '" . $tid . "';");
    }
    $t_inf = mysql_fetch_assoc($q);
    if ($w_inf['location'] != $t_inf['location']) {
        return 0;
    }
    // celq nedostezhima
    include_once 'modules/f_attack.php';
    attack($who, $to);
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:36,代码来源:f_mag_decl_attack.php

示例12: go_to_loc

function go_to_loc($who, $loc_go, $stor, $ok = 0)
{
    # get_pl_info(), do_mysql();, get_npc_info();, loc();, put_error();, delete_from_loc();, add_to_loc();, addjournal();
    require_once 'modules/f_get_pl_info.php';
    require_once 'modules/f_get_npc_info.php';
    require_once 'modules/f_loc.php';
    require_once 'modules/f_add_to_loc.php';
    // proverka dannyh
    // $who = preg_replace ('/[^a-z\._0-9]/i', '', $who);
    if (!$ok) {
        $loc_go = preg_replace('/[^a-z0-9\\|]/', '', $loc_go);
        $stor = preg_replace('/[^a-z0-9]/i', '', $stor);
    }
    // $stor - eto storona. dlja massiva
    // lokacija
    if (substr($who, 0, 2) == 'p.') {
        // login
        $login = substr($who, 2);
        $who = $login;
        $id = is_player($login);
        $lq = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
        $loc = mysql_result($lq, 0);
        $lq = do_mysql("SELECT name FROM players WHERE id_player = '" . $id . "';");
        $name = mysql_result($lq, 0);
        //$loc = get_pl_info ($login, 'location');
        $qg = do_mysql("SELECT gender FROM players WHERE id_player = '" . $id . "';");
        $gender = mysql_result($qg, 0);
        $qg = do_mysql("SELECT walking FROM players WHERE id_player = '" . $id . "';");
        $w = mysql_result($qg, 0);
        if ($w > 0) {
            $CAN_JUMP = 1;
        }
        $qg = do_mysql("SELECT carry FROM players WHERE id_player = '" . $id . "';");
        $carry = mysql_result($qg, 0);
        include_once 'modules/f_get_pl_weight.php';
        if ($carry < get_pl_weight($login)) {
            put_g_error('вы перегруженны');
        }
        $n = 0;
        $who = $login;
        // proverka na boj -
        $q = do_mysql("SELECT in_battle FROM players WHERE id_player = '" . $id . "';");
        $inb = mysql_result($q, 0);
        $type = 'a';
    }
    if (substr($who, 0, 2) == 'n.') {
        $loc = get_npc_info($who, 'location');
        $id = is_npc($who);
        // adding npc to move log -
        global $NPC_MOVED;
        $NPC_MOVED[$id] = 1;
        $alo = do_mysql("SELECT name FROM npc WHERE id_npc = '" . $id . "';");
        $login = mysql_result($alo, 0);
        $name = $login;
        $alo = do_mysql("SELECT type FROM npc WHERE id_npc = '" . $id . "';");
        $type = mysql_result($alo, 0);
        $n = 1;
        $inb = 0;
    }
    # vozmozhny dva puti - na druguju kartu ili prosto na druguju lokaciju
    # na druguju kartu ne storony, potomu prosto stor = 'nmap';
    # na druguju lokaciju - togda cherez near
    // ESLI NA DRUGUJU KARU
    $show_info = 0;
    if (substr($loc, 0, 4) != substr($loc_go, 0, 4)) {
        global $NEWMAP;
        $NEWMAP = 1;
        // a eshe ustanovim flag show_info, po kotoromu potom opredelim, nado li pokazatq vstupitelqnyj tekst k loakacci
        $show_info = 1;
        // zlye npc nemogut idti v goroda
        if ($type == 'x') {
            $toloc = substr($loc_go, 0, 4);
            if ($toloc == 'rele' || $toloc == 'elfc' || $toloc == 'verg') {
                return 0;
            }
        }
    }
    $li = '';
    // voobshem eto tazhe lokacija
    include_once 'modules/f_can_u_reach.php';
    $depth = 1;
    if (isset($_GET['jump']) && isset($CAN_JUMP)) {
        $depth = 2;
    }
    // esli v okruzhnoj lokacii netu takoj loki v takuju storonu, to idti nelzja
    if (!can_u_reach($who, $loc_go, $stor, $depth)) {
        //put_error ('<p>извините, но в указаном направлении такой локации нет</p>');
        return 0;
    }
    if ($depth == 2) {
        // get loc v can u reach
        $ll = get_loc($who, $stor, 1);
        add_journal($name . ' пронесся мимо!', 'l.' . $ll);
    }
    // est9q li loka na kotoruju idut?
    //////////////////////////////
    // pitomec
    $an = do_mysql("SELECT name, fullname FROM npc WHERE belongs = '" . $who . "' AND location = '" . $loc . "' AND move <> 0;");
    $an = mysql_fetch_assoc($an);
    if ($an['fullname']) {
//.........这里部分代码省略.........
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:101,代码来源:f_go_to_loc.php

示例13: put_g_error

            break;
        case 'tre':
            $numb = 15;
            break;
    }
    if ($p['skills'][0] < $itinf[0] || $p['skills'][1] < $itinf[1] || $p['skills'][2] < $itinf[2] || $p['skills'][3] < $itinf[3] || $p['skills'][$numb] < $itinf[4]) {
        put_g_error('вы не можете одеть вещь, у нее слишком высокие характеристики');
    }
    $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $LOGIN . "' AND is_in = 'wea';");
    if (!mysql_num_rows($q)) {
        $weap = '';
    } else {
        $weap = mysql_result($q, 0);
    }
    if (strpos($weap, '.2h.') !== false) {
        put_g_error('вы неможете одеть второе оружие, у вас двуручное оружие в руках');
    }
    // togda chto tam?
    $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $LOGIN . "' AND is_in = 'shi';");
    if (!mysql_num_rows($q)) {
        do_mysql("UPDATE items SET is_in = 'shi' WHERE fullname = '" . $item . "';");
    } else {
        // mestami menjaem
        $fn = mysql_result($q, 0);
        do_mysql("UPDATE items SET is_in = 'inv' WHERE fullname = '" . $fn . "';");
        do_mysql("UPDATE items SET is_in = 'shi' WHERE fullname = '" . $item . "';");
    }
    $f .= 'вы одели ' . $is_in['name'] . '!';
}
add_journal($f, $LOGIN);
$_GET['type'] = 3;
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:31,代码来源:s_take_2w.php

示例14: preg_replace

<?php 
// brositq melkuju veshq v lokaciju:
// dlja etogo prosto peremestim iz inventarja v lokaciju esli kidaetsja vse, ili zhe sozdadim novuju, esli ne vse:
$item = preg_replace('/[^a-z0-9_\\.]/i', '', $_GET['item']);
$count = preg_replace('/[^0-9]/', '', $_GET['count']);
$q = do_mysql("SELECT on_take FROM items WHERE belongs = '" . $LOGIN . "' AND fullname = '" . $item . "' AND is_in <> 'ban';");
if (!mysql_num_rows($q)) {
    put_g_error('у вас нету этой вещи!');
}
$count_i = mysql_result($q, 0);
if ($count > $count_i) {
    $count = $count_i;
}
if (!$count) {
    $count = 1;
}
$iq = do_mysql("SELECT name FROM items WHERE fullname = '" . $item . "';");
$itname = mysql_result($iq, 0);
include_once 'modules/f_add_item_to_loc.php';
// esli kidaetsja vse:
if ($count == $count_i) {
    add_item_to_loc($p['location'], $item);
} else {
    include_once 'modules/f_decrease_misc.php';
    include_once 'modules/f_create_item_m.php';
    include_once 'modules/f_real_name.php';
    $rn = real_name($item);
    $nitem = create_item_m($rn, $count);
    decrease_misc($item, $count);
    add_item_to_loc($p['location'], $nitem);
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:31,代码来源:s_drop_misc2.php

示例15: preg_replace

    $f .= 'пшел вон с глаз моих!</a>';
}
if ($part == 'name1') {
    $f .= '<form action="game.php" method="get">';
    $f .= 'кличка (латынь):<br/>';
    $f .= '<input type="text" name="name"/>';
    $f .= '<input type="hidden" name="sid" value="' . $sid . '"/>';
    $f .= '<input type="hidden" name="npc" value="' . $npc . '"/>';
    $f .= '<input type="hidden" name="action" value="talk_to_priru"/>';
    $f .= '<input type="hidden" name="part" value="name2"/><br/>';
    $f .= '<input type="submit" value="назвать"/></form>';
}
if ($part == 'name2') {
    $name = preg_replace('/[^a-z]/i', '', $_GET['name']);
    if (!$name) {
        put_g_error('как там назвать??');
    }
    $nn['name'] = preg_replace('/[a-z]/i', '', $nn['name']);
    $nn['name'] .= ' ' . $name;
    do_mysql("UPDATE npc SET name = '" . $nn['name'] . "' WHERE id_npc = '" . $nid . "';");
    $f .= 'вы назвали своего питомца ' . $name . '<br/>';
} else {
    if ($part == 'stay') {
        if ($nn['move'] != 0) {
            $nn['move'] = 0;
            $f .= $nn['name'] . ' будет стоять на этом месте';
        } else {
            $nn['move'] = 30;
            $f .= $nn['name'] . ' сного пойдет за вами!';
        }
        do_mysql("UPDATE npc SET move = '" . $nn['move'] . "' WHERE id_npc = '" . $nid . "';");
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:31,代码来源:s_talk_to_priru.php


注:本文中的put_g_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。