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

[Solved]getSecureMode

margoh

{{ user.title }}
Joined
Apr 1, 2013
Messages
806
Solutions
18
Reaction score
350
Hello,

I tried to make chars not able to attack other players with securemode on.
It's working in 90%.

I can't attack anyone without securemode, but when i change securemode to off I am able to attack byt I don't deal any dmg.
I can attack other player only when this other player have securemode off D:

I looked for help on my native language, but there are only spam noobs... and only gushing idiots...

Here are script codes:

Lua:
function onCombat(cid,attacker,target)
    if(attacker and isPlayer(target) and getPlayerSecureMode(cid) == 0) then 
        doPlayerSendCancel(cid, "Turn secure mode off if you really want to attack unmarked players.") 
        return false
      end
    return true
    end

Lua:
function onTarget(cid, target)
	if(target and isPlayer(target) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getPlayerSecureMode(cid) == 0) then
		return false
end
return true
end
 
function onStatsChange(cid, target, type, combat, value)
	if(target and isPlayer(target) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getPlayerSecureMode(cid) == 0) then
return false
end
return true
end
 
function onCast(cid, target)
	if(target and isPlayer(target) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getPlayerSecureMode(cid) == 0) then
return false
end
return true
end

Hope someone can help me.

Best regards,
margoh.
 
Last edited:
Mind sharing the solution with others?

Just one script
Code:
function onCombat(cid, target)
    if isPlayer(target) then
        if getPlayerSecureMode(cid) == 0 then
            doPlayerSendCancel(cid,"Turn secure mode off if you really want to attack unmarked palyers.")
            return false
        elseif getPlayerSecureMode(cid) == 1 then
            return true
        end
    end  
    return true
end

Code:
registerCreatureEvent(cid, "SecureH")

Code:
<event type="combat"         name="SecureH"         script="SecureCheck.lua"/>
 
Back
Top