Hello dear Otlanders.
I got this Swap Script but i wanna change the using of it.
At the moment its an spell to change place with monsters and targeting players.
I want it to be so noob players cant block ways and spawns
[Spell - Swap]:
I want it to work like this but swaping positions instead of teleporting.
[Talk - Teleport Noob Chars Blocking]:
Thanks for your time.
Yours DanneZ
I got this Swap Script but i wanna change the using of it.
At the moment its an spell to change place with monsters and targeting players.
I want it to be so noob players cant block ways and spawns
[Spell - Swap]:
Code:
local combat = createCombatObject()
local config = {
notAllowed = {"training monk", "Slaktaren", "Admin"},
exhaustStorage = 1338,
exhaustTime = 5, -- Seconds
slowStorage = 1339,
slowTime = 3, -- Seconds
slowSpeed = 100, -- Speed will be set to 100 when swaping for slowTime seconds.
}
function effect(cid, var, targetpos, mypos, target)
doSendMagicEffect(mypos, CONST_ME_ENERGYHIT)
doSendMagicEffect(targetpos, CONST_ME_ENERGYHIT)
end
function slowed(cid, speed)
doChangeSpeed(cid, getPlayerStorageValue(cid, config.slowStorage) - getCreatureSpeed(cid))
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
end
function onCastSpell(cid, var)
setPlayerStorageValue(cid, config.slowStorage, getCreatureSpeed(cid))
local mypos = getCreaturePosition(cid)
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
if not exhaustion.get(cid, config.exhaustStorage) then
for _,v in ipairs(config.notAllowed) do
if string.find(getCreatureName(target):lower(), v) then
doPlayerSendCancel(cid, "You can't swap " .. getCreatureName(target) .. "!")
doSendMagicEffect(mypos, CONST_ME_POFF)
return false
else
doTeleportThing(cid, targetpos)
doTeleportThing(target, mypos)
doChangeSpeed(cid, -getCreatureSpeed(cid)+config.slowSpeed)
doSendDistanceShoot(mypos, targetpos, CONST_ANI_ENERGYBALL)
doSendDistanceShoot(targetpos, mypos, CONST_ANI_ENERGYBALL)
addEvent(effect, 150, cid, var, targetpos, mypos, target)
addEvent(slowed, config.slowTime * 1000, cid, speed)
exhaustion.set(cid, config.exhaustStorage, config.exhaustTime)
end
end
else
doPlayerSendCancel(cid, "You have to wait " .. exhaustion.get(cid, config.exhaustStorage) .. " seconds to swap positions again!")
return false
end
doCombat(cid, combat, var)
return true
end
I want it to work like this but swaping positions instead of teleporting.
[Talk - Teleport Noob Chars Blocking]:
Code:
local waittime = 30 --Default (30 seconds)
local storage = 50
function onSay(cid, words, param, channel)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end
local pid = getPlayerByNameWildcard(param)
if(pid == 0 or (isPlayerGhost(pid) == TRUE and getPlayerAccess(pid) > getPlayerAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
return TRUE
end
if getPlayerLevel(pid) < 50 then
if exhaustion.get(cid, storage) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has been sent to temple.")
nPos = {x=32369, y=32241, z=7}
doTeleportThing(pid, nPos)
exhaustion.set(cid, storage, waittime)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. exhaustion.get(cid, storage) .. " seconds.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The player is higer then lvl 50.")
end
return TRUE
end
Thanks for your time.
Yours DanneZ
Last edited: