• 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!

Experience for killing players - is it possible to block if player uses mc?

ligus

New Member
Joined
Apr 26, 2010
Messages
253
Reaction score
0
Hey, is it possible to make something like this:
Player X kills two times Player Y (for example in 60 seconds) -> then Player X will not get exp for killing Player Y?
 
<event type="kill" name="no-exp" event="script" value="enforced.lua"/>


function remove_exp(cid, old)
if isPlayer(cid) then
doPlayerAddExperience(cid, - (getPlayerExperience(cid) - old))
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Exp from MC not allowed!')
end
end

function onKill(cid, target, flags)
if not isPlayer(target) then
return true
end

if (getPlayerIp(cid) == getPlayerIp(target)) then
if(flags % 2 == 1) then
addEvent(remove_exp, 100, cid, getPlayerExperience(cid))
end
end
return true
end
 
<event type="kill" name="no-exp" event="script" value="enforced.lua"/>


function remove_exp(cid, old)
if isPlayer(cid) then
doPlayerAddExperience(cid, - (getPlayerExperience(cid) - old))
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'Exp from MC not allowed!')
end
end

function onKill(cid, target, flags)
if not isPlayer(target) then
return true
end

if (getPlayerIp(cid) == getPlayerIp(target)) then
if(flags % 2 == 1) then
addEvent(remove_exp, 100, cid, getPlayerExperience(cid))
end
end
return true
end

Thanks but it does not work, it changed nothing :/
 
I do not understan one thing.
search the function:
Code:
double Player::getGainedExperience(Creature* attacker) const

then goto:
Code:
Player* attackerPlayer = attacker->getPlayer();
    if(!attackerPlayer || attackerPlayer == this)
        return 0;

and add this:
Code:
if(attackerPlayer->getIP() == getIP() && !g_config.getBool(ConfigManager::GAIN_EXP_FROM_SAME_IP))
        return 0;

Where should I add this?


Should I replace
Code:
if(!attackerPlayer || attackerPlayer == this)
to
Code:
if(attackerPlayer->getIP() == getIP() && !g_config.getBool(ConfigManager::GAIN_EXP_FROM_SAME_IP))
?




E: sorry for double post :p
 
Back
Top