Nerevr back
Member
- Joined
- Nov 7, 2014
- Messages
- 269
- Reaction score
- 7
when start paceman event give me this error
im use 0.4 sun
Code:
-- Pacman script: Controller [TGY]
pressedTiles = {}
gameStarted = false
dif = 1
local function pacmanCounter(text, start, col, dif)
if start then
gameStarted = true
doCreateMonster("Pacman Ghost", {x = 32148, y = 32012, z = 15})
if dif > 1 then
doCreateMonster("Pacman Ghost", {x = 32157, y = 32012, z = 15})
end
if dif > 2 then
doCreateMonster("Pacman Ghost", {x = 32153, y = 32012, z = 15})
end
end
doSendAnimatedText({x = 32152, y = 32016, z = 15}, text, col)
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if false == isPlayer(cid) then
return
end
if item.actionid == 5301 and item.itemid == 426 then
-- HANDLE TILE
if not gameStarted then
--doPlayerPopupFYI(cid, "x")
doTeleportThing(cid, fromPosition, true)
return true
end
doTransformItem(item.uid, 415)
table.insert(pressedTiles, position)
local cnt = #pressedTiles
doSendAnimatedText(position, (cnt).."/84", TEXTCOLOR_GREEN)
if cnt > 83 then
doTeleportThing(cid, {x = 32154, y = 32009, z = 14}, true)
doSendAnimatedText(position, ":D", TEXTCOLOR_GREEN)
local prize = 5
if dif == 2 then prize = 10 end
if dif == 3 then prize = 20 end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[PACMAN] You won ".. prize .." Game Tokens!")
doPlayerAddItem(cid,6527,prize)
end
elseif item.actionid == 7392 then
-- HANDLE JOINING PERSON
local c = isCreatureInArea({x = 32147, y = 32011, z = 15},{x = 32157, y = 32021, z = 15}) -- Getting crss inside
for _,v in pairs(c) do
if isPlayer(v) then
doTeleportThing(cid, fromPosition, true)
return true
end
end
-- Nobody is inside, check ticket/pick it - check exhaust first
--doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minutes till you can play again.")
if getPlayerStorageValue(cid, 7948) > 0 and (os.time() < getPlayerStorageValue(cid, 7948)) then
doTeleportThing(cid, fromPosition, true)
doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minute(s) till you can play again.")
return true
end
if getPlayerItemCount(cid, 6527) < 1 then
doTeleportThing(cid, fromPosition, true)
doPlayerPopupFYI(cid, "You need 1 Game Token to play.")
return true
end
doPlayerRemoveItem(cid, 6527, 1)
setPlayerStorageValue(cid, 7948, os.time() + 900)
-- Set difficulity variabele
dif = 1
if item.uid == 7396 then
dif = 2
elseif item.uid == 7397 then
dif = 3
end
-- Clean the area and reset the tiles now
for _,v in pairs(c) do
doRemoveCreature(v)
end
for _,v in pairs(pressedTiles) do
doItemSetAttribute(doCreateItem(426, v),"aid", 5301)
end
pressedTiles = {}
gameStarted = false
doTeleportThing(cid, {x = 32152, y = 32016, z = 15}, true)
pacmanCounter("3", false, TEXTCOLOR_RED, dif)
addEvent(pacmanCounter,1000,"2", false, TEXTCOLOR_ORANGE, dif)
addEvent(pacmanCounter,2000,"1", false, TEXTCOLOR_YELLOW, dif)
addEvent(pacmanCounter,3000,"GO!", true, TEXTCOLOR_GREEN, dif)
end
return true
end
Last edited: