• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Monster Kills

gurden

i need support for my server, good scripter!
Joined
May 19, 2009
Messages
519
Reaction score
5
Location
Sweden
Heey i need help with the homepage script Monster kills. I add a monster on the list. but it doesent count. If a guy kill a demon ingame it dousent count up. Any idea'?? here is the codes...


Code:
<!--
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.


 This is the website script..


    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
 -->
<!--
    vorgpl_monsterskills was wroted by Victor.
    For help ask at otland.net thread.
    You can also read my blog at victor.org.pl.
    Thank you for use it and regarding license.
 -->
<?php
//PREDEFINED
define('MONSTERLINK', '?subtopic=creatures&creature=');
define('MONSTERSPATH', 'monsters/');

define('IMAGE', TRUE); // images enabled or disabled?
define('IMAGESIZE', '55'); // images size in pixels (width and height in one)
//MONSTERSKILLS
$main_content .= '
    <div style="text-align: center; margin: 20px auto; font-size: 26px; font-weight: bold;">
        <img src="monsters/orc.gif" /><br />
        Monsters kills
    </div>';

//GUILDINWAR - TABLE
$main_content .= '
<table style="width: 100%; border: 0px;" cellpadding="4" cellspacing="1">
    <tbody>
        <tr style="background: #505050; text-align: center; font-weight: bold;">';
            if (IMAGE) {
                $main_content .= '
                <td class="white" style="width: '.IMAGESIZE.'px;">
                    Image
                </td>';
            }
            $main_content .= '
            <td class="white" style="width: 45%;">
                Monster
            </td>
            <td class="white" style="width: auto;">
                Kill(s)
            </td>
        </tr>';

//MONSTERSKILLS - TABLE
$mtc = 0;
$monsterskills = $SQL->query('SELECT mid, name, kills FROM vorgpl_monsterskills ORDER BY name ASC');

if ($monsterskills->rowCount() <> 0) {
    foreach ($monsterskills->fetchAll() as $monsterkills) {
            
        if ($mtc % 2) {
            $color = '#f1e0c6';
        }
        else {
            $color = '#d4c0a1';
        }
        
        if (IMAGE) {
            //ucwords not cuz linux...
            $name = $monsterkills['name'];
        
            if (file_exists(MONSTERSPATH.$name.'.gif')) {
                $image = '<img src="'.MONSTERSPATH.$name.'.gif" style="width: '.IMAGESIZE.'px; height: '.IMAGESIZE.'px;" />';
            }
            else {
                $image = '<img src="'.MONSTERSPATH.'nophoto.png" />';
            }
        }

        //ucwords
        $name = ucwords($monsterkills['name']);
        $kills = (int)$monsterkills['kills'];    

        $main_content .= '
        <tr bgcolor="'.$color.'">';
            if (IMAGE) {
                $main_content .= '
                <td style="text-align: center;">
                    '.$image.'
                </td>';
            }
            $main_content .= '
            <td style="text-align: center; font-weight: bold;">
                <a href="'.MONSTERLINK.$name.'">'.$name.'</a>
            </td>
            <td style="text-align: center; font-weight: bold;">
                '.$kills.'
            </td>
        </tr>';
    }
}
else {
    $main_content .= '
    <tr style="background: #d4c0a1; text-align: center;">
        <td colspan="3">
            There are not any monster kills today.
        </td>
    </tr>';
}

//MONSTERSKILLS - FINSIH TABLE
$main_content .= '</tbody></table>';

/*COPYRIGHTS
  I think you know don't remove ;). It's under GNU GPL license guy :).
 */
$main_content .= '
    <div style="text-align: right; margin: 20px auto; font-size: 10px;">
        Lua and PHP coded and copyright by <a href="http://www.victor.org.pl/">Victor</a>.
    </div>';
?>


here is the globalevent script..

Code:
--	This program is free software: you can redistribute it and/or modify
--	it under the terms of the GNU General Public License as published by
--	the Free Software Foundation, either version 3 of the License, or
--	(at your option) any later version.
--
--	This program is distributed in the hope that it will be useful,
--	but WITHOUT ANY WARRANTY; without even the implied warranty of
--	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--	GNU General Public License for more details.
--
--	You should have received a copy of the GNU General Public License
--	along with this program. If not, see <http://www.gnu.org/licenses/>.


--	vorgpl_monsterskills was wroted by Victor.
--	For help ask at otland.net thread.
--	You can also read my blog at victor.org.pl.
--	Thank you for use it and regarding license.

local config = {
	interval = 24 * 60 * 1,
	storage = 24387
}

function onThink(interval, lastExecution)
	local storage = getGlobalStorageValue(config.storage)
	local time = os.time()
	
	if ((storage + config.interval) < time or storage == -1) then
		db.executeQuery("DELETE FROM vorgpl_monsterskills")
		setGlobalStorageValue(config.storage, time)
		broadcastMessage("Monsters kills was reset.")
	end		
	return TRUE
end

here is the creaturescript

Code:
  --[[
        ** Monster weapon upgrader by slawkens **
        ** Updated to version 2.0 by Shawak **

        [ignore_monsters]
        - type "yes" and only by the [monsters] the weapon gain kills
        [monsters]
        • {"..","..",".."} - list of monsters where weapon gain kills
        [ingore_weapons]
        - type "yes" and only the [weapons] can be upgraded
        [weapons]
        •       [2395] = {100, 1, 5},
                   |       |   |  |
                   |       |   |  •> extraAttackLimit
                   |       |   •> extraAttack
                   |       •> kills
                   •> id of the weapon
        [default]
        • kills - how much monsters must be killed
        • extraAttack - how much extraAttack points will this weapon get
        • extraAttackLimit - you can set limit of extraAttack points added
]]--


local ignore_monsters = "yes"
local monsters = {"Rat","Dragon","Dragon Lord"}

local ingore_weapons = "yes"
local weapons = {
        [2395] = {100, 1, 5},
        [2383] = {100, 1, 4}

} -- weapon end --

local default = {
        50,   -- kills
        1,     -- extraAttack
        5      -- extraAttackLimit
} -- default end --

function onKill(cid, target)
        if(isPlayer(target) == TRUE) then
                return TRUE
        end

        if (string.lower(ignore_monsters) == "no" and isInArray(monsters, getCreatureName(target)) == TRUE or string.lower(ignore_monsters) == "yes") then

                local playerWeapon = getPlayerWeapon(cid, TRUE)
                if(playerWeapon.itemid == 0) then
                        return TRUE
                end

                local weapon = weapons[getPlayerWeapon(cid).itemid]
                if string.lower(ingore_weapons) == "yes" then
                        weapon = default
                end

                if (string.lower(ingore_weapons) == "no" and (not weapon) == FALSE or string.lower(ingore_weapons) == "yes") then

                        local currentExtraAttack = getItemExtraAttack(playerWeapon.uid)
                        if(currentExtraAttack >= weapon[3]) then
                                return TRUE
                        end

                        local add = weapon[2]
                        if(currentExtraAttack + add > weapon[3]) then
                                add = currentExtraAttack - weapon[3]
                        end

                        if(playerWeapon.actionid ~= 0) then
                                if(playerWeapon.actionid >= weapon[1]+9999) then
                                        doSetItemActionId(playerWeapon.uid, 10000)
                                        setItemExtraAttack(playerWeapon.uid, currentExtraAttack + add)
                                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" ..add.. " attack points and now have total extra damage of +" .. getItemExtraAttack(playerWeapon.uid) .. " points!")
                                        doSetItemSpecialDescription(playerWeapon.uid, "["..(playerWeapon.actionid-9999).."/"..weapon[1].." | ".. getItemExtraAttack(playerWeapon.uid).."/"..weapon[3].."]")
                                else
                                        doSetItemActionId(playerWeapon.uid, playerWeapon.actionid + 1)
                                        doSetItemSpecialDescription(playerWeapon.uid, "["..(playerWeapon.actionid-9999).."/"..weapon[1].." | ".. getItemExtraAttack(playerWeapon.uid).."/"..weapon[3].."]")
                                end
                        else
                                doSetItemActionId(playerWeapon.uid, 10001)
                                doSetItemSpecialDescription(playerWeapon.uid, "[1/"..weapon[1].." | ".. getItemExtraAttack(playerWeapon.uid).."/"..weapon[3].."]")
                        end
                end
        end
        return TRUE
end
 
Back
Top