lSenturion2
Active Member
- Joined
- Oct 2, 2019
- Messages
- 124
- Reaction score
- 29
Hello my friends, i need support on this:
If player have the outfit 2080, a condition is added that gives it speed, but if the outfit is changed, to any other than 2080, the speed is removed (condition)
If player have the outfit 2080, a condition is added that gives it speed, but if the outfit is changed, to any other than 2080, the speed is removed (condition)
Code:
function onLogin(cid)
registerCreatureEvent(cid, "EffectOutLogin2")
registerCreatureEvent(cid, "OutfitEffects2")
return doCreatureChangeOutfit(cid,{lookType = getCreatureOutfit(cid).lookType, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons})
end
local speed1 = createConditionObject(CONDITION_HASTE)
setConditionParam(speed1, CONDITION_PARAM_TICKS, 24*60*60*1000)
setConditionParam(speed1, CONDITION_PARAM_SPEED, 500)
local events = {}
function onOutfit(cid, old, current)
local effect = {
[2080] = 66,[2080] = 66
}
local o,c= effect[old.lookType],effect[current.lookType]
if getPlayerAccess(cid) > 6 then
return true
elseif (not o or not c or old.lookAddons == 0 and o) then
stopEvent(events[getPlayerGUID(cid)])
end
if (getPlayerLevel(cid) > 8) and c then
function WalkEffect(cid, c, pos)
if not isCreature(cid) then
return LUA_ERROR
end
if c then frompos = getThingPos(cid)
if frompos.x ~= pos.x or frompos.y ~= pos.y or frompos.z ~= pos.z then
doAddCondition(cid, speed1)
end
events[getPlayerGUID(cid)] = addEvent(WalkEffect, 100, cid, c, frompos)
end
return true
end
WalkEffect(cid, c, {x=0, y=0, z=0})
end
return true
end