namco
Alienbutserious
- Joined
- Sep 5, 2010
- Messages
- 148
- Solutions
- 2
- Reaction score
- 38
TFS 1.3
I've tried this (and EVERY LITTLE VARIATION):
With:
But I've got this error:
Here's the entire script:
I've tried this (and EVERY LITTLE VARIATION):
Lua:
local function decara(player)
local player = Player(playerId)
player:setStorageValue(420, 0) -- line 43 which gets the error
end
With:
Lua:
addEvent(decara, 10000, playerId)
But I've got this error:
Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
D:\forgottenserver\data\scripts\actions\marijuanna.lua:43: attempt to index local 'player' (a nil value)
stack traceback:
[C]: in function '__index'
D:\forgottenserver\data\scripts\actions\marijuanna.lua:43: in function <D:\forgottenserver\data\scripts\actions\marijuanna.lua:41>
Here's the entire script:
Lua:
local fumar = Action() -- usar a tocha no baseado fuma ele
local function decara(player)
local player = Player(playerId)
player:setStorageValue(420, 0)
end
function fumar.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(420) ~= 0 then -- checa se ta chapado
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You must wait 10 seconds between smokes.")
return true
end
if target.itemid == 7499 then -- joint
target:remove(1)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
local outfit = player:getOutfit()
outfit.lookHead = math.random(0, 132)
outfit.lookBody = math.random(0, 132)
outfit.lookLegs = math.random(0, 132)
outfit.lookFeet = math.random(0, 132)
player:setOutfit(outfit)
player:say("Uuhf.", TALKTYPE_MONSTER_SAY)
player:setStorageValue(420, 1) -- fica chapado
addEvent(decara, 10000, playerId) -- fica de cara depois de 10 segundos
return true
end
end
fumar:id(8304, 9956, 2055)
fumar:register()
Last edited: