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

Solution To Pvp Enforced. (FREE KILL)

dukzin

New Member
Joined
Aug 18, 2008
Messages
161
Reaction score
3
Pvp Enforced; Frag Rank. [Bugged]

Frag Ranks Isn't Working.

OnKill;
Code:
function onKill(cid, target, lastHit)
	if isPlayer(target) then
		if getPlayerIp(cid) == getPlayerIp(target) then
			return doPlayerAddExp(cid, -40000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same IP.")
		elseif getPlayerParty(cid) and getPlayerParty(target) and getPlayerParty(cid) == getPlayerParty(target) then
			return doPlayerAddExp(cid, -15000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same Party.")
		end
		return doPlayerAddItem(cid, 2152, 1) and setPlayerStorageValue(cid, 3943, getPlayerStorageValue(cid, 3943)+1) and doPlayerSave(cid)
	end
	return true
end

Frag Rank;
Code:
function getPlayerNameByGUID2(n)
	local ret = 'SQL_ERROR['..n..']'
	local c = db.getResult('SELECT `name` FROM `players` WHERE `id` = '..n..' LIMIT 1;')
	if c:getID() ~= -1 then
		ret = c:getDataString('name')
	end
	c:free()
	return ret
end

local max = 10

function onSay(cid, words, param)
	local letters_to_next, name_now, name, param, l, space = 20, nil, 'Highscore for level\n', param:lower(), nil, nil
	if param == 'frag' or param == 'frags' then
		name = name..'Rank Frags - Nome do Jogador\n'
		local v = db.getResult('SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 3943 ORDER BY `value` DESC;')
		local i = 0
		repeat
			if i == max or v:getID() == -1 then
				break
			end
			i = i + 1
			name_now, l = getPlayerNameByGUID2(v:getDataInt('player_id')), getPlayerNameByGUID2(v:getDataInt('player_id')):len()
			space = ''
			for i = 1, letters_to_next-l do
				space = space..' '
			end
			if not name_now then
				name_now = 'sql error['..v:getDataInt('player_id')..']'
			end
			name = name..i..'. '..v:getDataInt('value')..'  -  '..name_now..space..' \n'
		until not v:next()
		v:free()
	end
	if name ~= 'Highscore\n' then 
		doPlayerPopupFYI(cid, name)
	end
	return true
end

Screen;
rankzh.jpg



[The Frag Rank Isn't in sequence..] (AS U CAN SEE)
 
Last edited:
about the pvp enfo (Free kill), I think there's no problem with it. I mean
If 2 players accept party and someone kills the other one that is on party, him wont get pz. (like on global)
Probably your problem is that they gain exp. If is that the problem i can't help. Sorry
*correct me if im wrong :p*

so you need a script that gain the storage value 3943 +1?
Code:
-- did you refer something like this?
if getPlayerStorageValue(cid, 3943) <= 0 then
   setPlayerStorageValue(cid, 3943, +1)
end

Regards, Efren.
 
Last edited:
Code:
function Remove()
    setPlayerStorageValue(k, getPlayerIp(p), getPlayerStorageValue(k, getPlayerIp(p)-1))
end

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if getPlayerStorageValue(lastHitKiller, getPlayerIp(cid) <= 2 then
        setPlayerStorageValue(lastHitKiller, getPlayerIp(cid), getPlayerStorageValue(lastHitKiller, getPlayerIp(cid)+1)
        addEvent(Remove, 15 * 60 * 1000)
        k = lastHitKiller
        p = cid
    else
        doPlayerAddExperience(lastHitKiller, -50000)
        setPlayerStorageValue(lastHitKiller, getPlayerIp(cid), 0)
    end
    return TRUE
end
Wouldn't something like this work?
Every time you last hit someone, his Ip is stored as a storage value
The value will be +1 every time you get last hit on someone
When you have last hited the same person 3 times you will get -50000 exp and the value is set to 0
Every 15 minutes the value will be 1 less. So if you kill 2 players the value is 2, after 15 minutes it will be 1 again
Sorry for my english, it's not perfect :p

I'm not sure it will work though :p If it doesn't, I hope some of the better scripters get the idea
 
SCRIPT FRAG REWARD NOW:
Code:
function onKill(cid, target)
    if isPlayer(target) == TRUE then
        if getPlayerIp(cid) ~= getPlayerIp(target) then
        loot = 2152 
        item = doPlayerAddItem(cid,loot,1)
        elseif getPlayerName(cid) == getPlayerName(target) then
            doPlayerAddItem(cid,loot,1)
   setPlayerStorageValue(cid, 3943, +1)

        else
            doPlayerAddExperience(cid, -60000000)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.")
        end
    end
    return TRUE
end
WILL TRY!



Slaktaren,
Is Something like that that i want...
Try to make it with another funcion. '-'

i think that's something wrong cuz, when i run the script,
i wait some mins and the server crashes, and without that line of storage
it keeps online all time... ;s
 
Last edited by a moderator:
o_O

i dont know how to script..
this script comes with the ot..

i think that it checks only the ip, and add cash to the killer..
is that i want.. but i want to everbody who win the cash gets a storage 3943 +1. Because i have a frag rank, and it check's this storage.
 
Code:
function onKill(cid, target, lastHit)
	if getPlayerParty(cid) == getPlayerParty(target) or getPlayerIp(cid) == getPlayerIp(target) then return doPlayerAddExp(cid, -60000000) and doPlayerSendTextMessage(cid, 20, "You have been punished for killing a player of the same IP.") and setPlayerStorageValue(cid, 3000, getPlayerStorageValue(cid, 3000)+1) end
	return doPlayerAddItem(cid, 2152, 1)
end
 
can u separate the exp from kill same ip and party player? i want lower exp to party...

and add the storage and the gold only for 2 players that kill

please ;x
 
like this?
Code:
function onKill(cid, target, lastHit)
	if getPlayerIP(cid) == getPlayerIP(target) then
		return doPlayerAddExp(cid, -60000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same IP.") and setPlayerStorageValue(cid, 69012, getPlayerStorageValue(cid, 69012)+1)
	elseif getPlayerParty(cid) == getPlayerParty(target) then
		return doPlayerAddExp(cid, -80000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same Party.") and setPlayerStorageValue(cid, 69011, getPlayerStorageValue(cid, 69011)+1)
	end
	return doPlayerAddItem(cid, 2152, 1)
end
 
Code:
function onKill(cid, target, lastHit)
	if getPlayerIP(cid) == getPlayerIP(target) then
		return doPlayerAddExp(cid, -10000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same IP.")
	elseif getPlayerParty(cid) == getPlayerParty(target) then
		return doPlayerAddExp(cid, -8000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same Party.")
	end
	return doPlayerAddItem(cid, 2152, 1)
	setPlayerStorageValue(cid, 3943, getPlayerStorageValue(cid, 3943)+1)
end

Is this that i want,
edited yours.
it works?
i will test! ;s

-EDIT
WHEN I KILL SOMEBODY SERVER's CRASH.


the problem is
on this line:
Code:
	setPlayerStorageValue(cid, 3943, getPlayerStorageValue(cid, 3943)+1)
 
Last edited:
You may only bump your thread after 24 hours have passed since the last post on it. Also, please use the Edit button instead of posting multiple times in a row.
 
Will test,
i will edit here.


error:


Code:
function onKill(cid, target, lastHit)
	if getPlayerIP(cid) == getPlayerIP(target) then
		return doPlayerAddExp(cid, -40000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same IP.")
	elseif getPlayerParty(cid) == getPlayerParty(target) then
		return doPlayerAddExp(cid, -15000000) and doPlayerSendTextMessage(cid, 27, "You have been punished for killing a player of the same Party.")
	end
    return doPlayerAddItem(cid, 2152, 1) and setPlayerStorageValue(cid, 3943, getPlayerStorageValue(cid, 3943)+1) 
end




--
and this script:
Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 125) -- 125% Total Hp

function onEquip(cid, item, slot)
	return doAddCondition(cid, condition) and doPlayerSave(cid, true)
end

function onDeEquip(cid, item, slot)
    return doRemoveCondition(cid, CONDITION_ATTRIBUTES) and doPlayerSave(cid, true);
end

dont remove the health when 'DeEquip'
 
Last edited:
Back
Top