• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Reputation for killing monsters, players.

Btw almost everything works fine (not the 'certain' monsters one, havent tested that one yet), but on the talkaction script, remember to return TRUE at the end, so it doesnt show on log. Like this:

Lua:
function onSay(cid, words, param, channel)
	
	-- Config --
	
	storage = 666
	local reputation = getPlayerStorageValue(cid,storage)
	
	-- Script --
	
	if reputation == 1 or reputation == 0 then
		doPlayerSendCancel(cid, "You have ".. reputation .." reputation point.")
	else
		doPlayerSendCancel(cid, "You have ".. reputation .." reputation points.")
	end
	return TRUE -- Here
end

Also, the only thing is that the players start with -1 rep points instead of 0.
And the onLook script from page 2 of this thread aint working out..
 
Last edited:
hallo
I have a little problem...

exempla:

[01/09/2009 17:44:39] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/reputation from monsters.lua)
[01/09/2009 17:44:39] data/creaturescripts/scripts/reputation from monsters.lua:29: 'end' expected (to close 'if' at line 26) near '<eof>


plx help me
 
@Up You dont copy full script!
Try again
Lua:
  function onKill(cid, target)
-- Config --
local storage = 666 -- Storage value of the script.
local script =
{
    name = getCreatureName(target), -- Do not edit.
    how_check = getPlayerStorageValue(cid,999), -- Do not edit.
    killed = getPlayerStorageValue(cid,storage), -- Do not edit.
    skull_check = getCreatureSkullType(target) -- Do not edit.
}
local how = 3 -- How many monsters need to get reput point.
local rep_for_monster = 1 -- How many reputation give for kill monster.
local rep_for_player = 5 -- How many reputation give for kill player without skull.
local rep_for_whiteskull = 10 -- How many reputation give for kill player with white skull.
local rep_for_redskull = 15 -- How many reputation give for kill player with red skull.
local rep_for_blackskull = 20 -- How many reputation give for kill player with black skull.
local points = script.killed + 1
local msg = "You have now ".. points .." points."
local msg_monster = "Congratulations, you have slained ".. how .." monsters and you gained ".. rep_for_monster.." reputation point." -- Standard message for killing monster you can edit this.
local msg_player = "Congratulations, you have killed a ".. script.name .." and you gained ".. rep_for_player .." reputation points." -- Standard message for killing player without skull you can edit this.
local msg_white = "Congratulations, you have killed a ".. script.name .." and you gained ".. rep_for_whiteskull .." reputation points." -- Standard message for killing player with white skull you can edit this.
local msg_red = "Congratulations, you have killed a ".. script.name .." and you gained ".. rep_for_redskull .." reputation points." -- Standard message for killing player with red skull you can edit this.
local msg_black = "Congratulations, you have killed a ".. script.name .." and you gained ".. rep_for_blackskull .." reputation points." -- Standard message for killing player with black skull you can edit this.

-- Script --
if(getPlayerStorageValue(cid,999) >= how -1) then
                setPlayerStorageValue(cid, storage,script.killed + rep_for_monster)
                doPlayerSendTextMessage(cid,22,msg_monster)
                doPlayerSendTextMessage(cid,23,msg)
                setPlayerStorageValue(cid, 999,0)
                return TRUE
elseif(isMonster(target) == TRUE) then
                setPlayerStorageValue(cid, 999,script.how_check + 1)
                return TRUE
elseif(isPlayer(target) == TRUE) then
                setPlayerStorageValue(cid, storage,script.killed + rep_for_player)
                doPlayerSendTextMessage(cid,22,msg_player)
                doPlayerSendTextMessage(cid,23,msg)
                return TRUE
elseif(isPlayer(target) == TRUE) and skull_check == 3 then
                setPlayerStorageValue(cid, storage,script.killed + rep_for_whiteskull)
                doPlayerSendTextMessage(cid,22,msg_white)
                doPlayerSendTextMessage(cid,23,msg)
                return TRUE
elseif(isPlayer(target) == TRUE) and skull_check == 4 then
                setPlayerStorageValue(cid, storage,script.killed + rep_for_redskull)
                doPlayerSendTextMessage(cid,22,msg_red)
                doPlayerSendTextMessage(cid,23,msg)
                return TRUE
elseif(isPlayer(target) == TRUE) and skull_check == 5 then
                setPlayerStorageValue(cid, storage,script.killed + rep_for_blackskull)
                doPlayerSendTextMessage(cid,22,msg_black)
                doPlayerSendTextMessage(cid,23,msg)
                return TRUE
        end
end
 
Error Character.php

PHP:
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\characters.php on line 484

Code:
PHP:
if($config['site']['show_reputation'])
            {
                    $id = $player->getCustomField("id");
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                    $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=10%>Reputation:</TD>';
                         $rep = $SQL->query('SELECT `value` FROM `player_storage` WHERE `player_id` = '.$id.' and `key` = '.$config['site']['show_reputation_storage'].';')->fetch();
                    if($id >= 0) {
                    $main_content .= '<TD><B>'.$rep[value].'</B></TD></TR>'; 
			}

please help!
 
Seems like a nice idea.
Personally though, I'd find the msgs. annoying for every monster I kill. I'd just keep them in the console or only give rep for bosses.
I'd also make it so that you lose rep for killing non-skull players.
 
PHP:
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\characters.php on line 484

Code:
PHP:
if($config['site']['show_reputation'])
            {
                    $id = $player->getCustomField("id");
                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                    $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=10%>Reputation:</TD>';
                         $rep = $SQL->query('SELECT `value` FROM `player_storage` WHERE `player_id` = '.$id.' and `key` = '.$config['site']['show_reputation_storage'].';')->fetch();
                    if($id >= 0) {
                    $main_content .= '<TD><B>'.$rep[value].'</B></TD></TR>'; 
			}

please help!

Im getting this same problem
 
Back
Top