-
Notifications
You must be signed in to change notification settings - Fork 9
/
anti-trap.xml
51 lines (45 loc) · 1.65 KB
/
anti-trap.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?xml version="1.0" encoding="UTF-8"?>
<mod name="anti-trap" version="1.3" author="slawkens" contact="[email protected]" enabled="yes">
<changelog><![CDATA[
* [01/08/2009 v1.1] From now, it cannot be used by protected players (config.protectionLevel)
* [07/08/2009 v1.2] Added optional param - player name, so it now works in diagonal directions!
* [18/05/2010 v1.3] Added !noob alias
]]></changelog>
<talkaction words="/noob;!noob" logged="no" event="script"><![CDATA[
local config = {
protectionLevel = getConfigValue('protectionLevel')
}
function onSay(cid, words, param, channel)
local pos = getCreaturePosition(cid)
if(getTileInfo(pos).protection) then
return true
end
local target = 0
param = param:trim()
if(param == '') then
pos = getPosByDir(pos, getCreatureLookDirection(cid))
target = getTopCreature(pos).uid
else
target = getPlayerByNameWildcard(param)
if(target ~= 0) then
pos = getCreaturePosition(target)
if(getDistanceBetween(getCreaturePosition(cid), pos) > 1) then
return true
end
end
end
if(target == 0 or getTileInfo(pos).protection or getPlayerCustomFlagValue(target, PlayerCustomFlag_GamemasterPrivileges)) then
return true
end
if(getPlayerLevel(cid) < config.protectionLevel or getPlayerLevel(target) >= config.protectionLevel) then
return true
end
local tmp = getCreaturePosition(cid)
if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return false
end
]]></talkaction>
</mod>