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

Frag reward with lvl and ip restriction - TFS 0.4 - 8.6

hanzoha

New Member
Joined
May 8, 2016
Messages
87
Reaction score
2
Hello guys.
I found a script for a frag reward in this thread
That is good, but I need that you only get reward if the player is higher than certain lvl and that doesn't have the same IP as you.

Can you help me?

Thx!
 
Code:
local level = 10 
function onKill(cid, target, lastHit)
    if (isPlayer(cid) and isPlayer(target)) then
        if (getPlayerLevel(cid) + level) < getPlayerLevel(target) then
            if getPlayerIp(cid) ~= getPlayerIp(target) then
                local create = doPlayerAddItem(cid, 7369, 1)
                doItemSetAttribute(create, 'description', "Trofeo por matar a "..getPlayerName(target).." en level "..getPlayerLevel(target).." cuando tu eras level "..getPlayerLevel(cid)..".")
                doPlayerSendTextMessage(cid, 24, "Te ganaste un trofeo por matar un player con lvl más alto que el tuyo.")
            end
        end
    end
    return true
end
 
Wow! Awesome, thx.
Is there a way to add a text for IP and level?
Like:
"No reward for killing a player with the same IP"
And "No reward for killing a player under lvl 100"
Thanks again.
 
Code:
local level = 10
function onKill(cid, target, lastHit)
    if (isPlayer(cid) and isPlayer(target)) then
        if (getPlayerLevel(cid) + level) < getPlayerLevel(target) then
            if getPlayerIp(cid) ~= getPlayerIp(target) then
                local create = doPlayerAddItem(cid, 7369, 1)
                doItemSetAttribute(create, 'description', "Trofeo por matar a "..getPlayerName(target).." en level "..getPlayerLevel(target).." cuando tu eras level "..getPlayerLevel(cid)..".")
                doPlayerSendTextMessage(cid, 24, "Te ganaste un trofeo por matar un player con lvl más alto que el tuyo.")
            else doPlayerSendTextMessage(cid, 24, "You don't get a reward for killing people with the same IP.")  -- You can transelate this
            end
        else doPlayerSendTextMessage(cid, 24, "You don't get a reward for killing people under level 100.") -- this too :p
        end
    end
    return true
end

Maybe this works. I'm noob at lua, so it probably won't work. :oops:

Can't test it atm.
 
Hi guys! I got an error in console... "Function ondeath not found".
I change the function to onKill to onDeath and it doesn't show no errors but nothing happens. Do you know why? THx!
 
Back
Top