Hello,
I'm having trouble scripting a pizza job. I want to make it so that you deliver 8 pizzas then you need to get new pizzas.
When I deliver a pizza, it doesn't go down.
This is a part of my script:
local pizzas = 0
local pcount = "0"
pizzasLeft = guiCreateLabel (0.82, 0.5, 5, 3.5, "Pizzas: "..pcount.."/8", true)
function pay()
if ( source == marker ) then
givePlayerMoney(5000)
local pizzas = pizzas - 1
local pcount = tostring(pizzas)
guiSetText(pizzasLeft, "Pizzas: " ..pcount.."/8")
destroyElement(marker)
destroyElement(blip)
destroyElement(pizzabox)
outputChatBox("Get in a Pizza Boy to get a new mission", 255, 204, 0)
end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), pay )
function refillmarker()
if pizzas < 1 then
refmarker = createMarker ( -1805, 944, 23.9, "cylinder", 1.5, 255, 25, 0, 170 )
refblip = createBlipAttachedTo(refmarker, 29)
outputChatBox("Go to the pizza store to get new pizzas")
function refill()
if ( source == refmarker ) then
pizzas = 8
local pcount = tostring(pizzas)
guiSetText(pizzasLeft, "Pizzas: " ..pcount.."/8")
destroyElement(refmarker)
destroyElement(refblip)
end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), refill )
Thanks for your help