Haju Torttu
Half-Life 3 Confirmed
I tried make script what changes players outfit to skeleton and players speed to 154 for 1 hour, but it crashes client when I use that lever. Can someone who's better in scripting than me fix that script?
actions.xml
skeletonchanger.lua
-----SOLVED-----
actions.xml
PHP:
<action actionid="6669" event="script" value="skeletonchanger.lua"/>
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doPlayerSendTextMessage(cid,251,"We have warned you to enter this room. and now we cursed you !")
doSetCreatureOutfit(cid,33, 36000)
doChangeSpeed(cid,154, 36000)
doTransformItem(item.uid, item.itemid + 1)
elseif item.itemid == 1946 then
doPlayerSendTextMessage(cid,251,"Seems this switch is only one-way !")
doTransformItem(item.uid, item.itemid - 1)
end
return TRUE
end
-----SOLVED-----
Well, it seems that the storage didnt get deleted.
go to creaturescripts/scripts/login.lua and under function onLogin(cid) add:
Lua:if getPlayerStorageValue(cid,3333) == 1 then setPlayerStorageValue(cid,3333,-1) end
Restart the server!
Try:
Lua:local Printer = { time = 60, --60 = 1min! storage = 3333, --add a unused storage outfit_name = "Skeleton", speed = 154 } function onUse(cid, item, fromPosition, itemEx, toPosition) function Back(cid) if isPlayer(cid) then doChangeSpeed(cid, getCreatureBaseSpeed(cid)) doPlayerSendTextMessage(cid,25,"The curse is gone.") doSendMagicEffect(getThingPos(cid),CONST_ME_HOLYAREA) setPlayerStorageValue(cid,Printer.storage, -1) end return true end if item.itemid == 1945 then if getPlayerStorageValue(cid,Printer.storage) == -1 then doPlayerSendTextMessage(cid,25,"We have warned you to enter this room. and now we cursed you !") doSetMonsterOutfit(cid, Printer.outfit_name, Printer.time*1000) addEvent(Back, Printer.time*1000, cid) doChangeSpeed(cid, Printer.speed - getCreatureSpeed(cid)) setPlayerStorageValue(cid,Printer.storage, 1) doTransformItem(item.uid, item.itemid + 1) else doPlayerSendTextMessage(cid,25,"You are cursed!") end elseif item.itemid == 1946 then doPlayerSendTextMessage(cid,25,"Seems this switch is only one-way !") doTransformItem(item.uid, item.itemid - 1) end return TRUE end
Last edited: