Jump to content

Why not working onMarkerHit?


Turbe$Z

Recommended Posts

function rablasletrehozasa()
	rablashelye = createMarker ( 252.3,-54.6,0.9, "cylinder", 1, 255, 255, 255, 170 )
	outputChatBox("A kisboltot újra kitudjátok rabolni", root, r,g,b,true)
end
addEventHandler("onResourceStart",resourceRoot,rablasletrehozasa)

function animaciovege(tp)
	setPedAnimation(tp,false)
end

function apenz(tp)
local penz = math.random(100000,600000)
	givePlayerMoney( tp, penz )  
	outputChatBox("Gratulálok! Kiraboltad a boltot. Kaptál érte: "..penz.." Forintot!",tp,r,g,b,true)
	setTimer(apenz,7000,1,thePlayer)
end

function beleallas(thePlayer)
if isElementWithinMarker(thePlayer, rablashelye) then
	outputChatBox("Írd be a rabláshoz, hogy /kirabol!",thePlayer,r,g,b,true)
	end
end
addEventHandler( "onMarkerHit", rablashelye, beleallas )

function kirabol(thePlayer)
if isElementWithinMarker(thePlayer, rablashelye) then
	setPedAnimation ( thePlayer, "INT_HOUSE", "wash_up")
	setTimer(animaciovege,7000,1,thePlayer)
	setTimer(apenz,7000,1,thePlayer)
	destroyElement(rablashelye)
else
	outputChatBox("Ez a parancs csak a kisboltban található markerben használható.")
	end
end
addCommandHandler("kirabol", kirabol)

 

Link to comment

feel free to use my own.

Edit the positions etc.

 

function Boltrablas(res)
if res == getThisResource() then
    local x, y, z = 2117.6228027344, 897.66882324219, 10
    robmarker1 = createMarker(x,y,z,"cylinder", 1.5, 255, 0, 0, 160)
    setElementCollisionsEnabled(robmarker1, false)
    blip = createBlipAttachedTo(robmarker1, 52)
end
end
addEventHandler("onResourceStart",resourceRoot,Boltrablas)

function boltrablas(source)
    if isElementWithinMarker(source, robmarker1) then
    local players = getPlayerCount()
        if tonumber(players) > 0 then   -- 1 a 2 játékos 
            setElementFrozen(source, true)
            setPedAnimation(source , "rob_bank", "cat_safe_rob", 30000, true, true, true, false) 
            setTimer(setElementFrozen,30000,1,source,false)
            randomM = math.random(0,150000)
            setTimer(function()
            givePlayerMoney(source,randomM)
            end,30000,1)
            setTimer(outputChatBox, 1000, 1,"#00B4FF"..getPlayerName(source).." #ffffffelkezdte rabolni a(z) #6F9F86Las Venturas, Las Venturas - benzinkutat.",root,255,255,255,true)
            setTimer(outputChatBox, 30000,1,"#00B4FF"..getPlayerName(source).." #ffffffVégzett a boltrablással. Összesen rabolt #007DFA"..randomM.." #ffffffdollárt.",root,255,255,255,true)
            setTimer(outputChatBox, 900000, 1,"#6F9F86Las Venturas, Las Venturas - benzinkút újra rabolható!",root,255,255,255,true)
            setTimer(Boltrablas,3600000,1) --< Óránként csinál rablást >--
            destroyElement(robmarker1)
            destroyElement(blip)
        else
            outputChatBox(" Legalább 2 játékosnak kell lennie a szerveren.",source,255,255,255,true)
        return end 
    else
        outputChatBox(" Ezt a parancsot csak bolt markerben használhatod.",source,255,255,255,true)
    end
end
addCommandHandler("rob",boltrablas)

 

Link to comment
11 minutes ago, TheMOG said:

feel free to use my own.

Edit the positions etc.

 


function Boltrablas(res)
if res == getThisResource() then
    local x, y, z = 2117.6228027344, 897.66882324219, 10
    robmarker1 = createMarker(x,y,z,"cylinder", 1.5, 255, 0, 0, 160)
    setElementCollisionsEnabled(robmarker1, false)
    blip = createBlipAttachedTo(robmarker1, 52)
end
end
addEventHandler("onResourceStart",resourceRoot,Boltrablas)

function boltrablas(source)
    if isElementWithinMarker(source, robmarker1) then
    local players = getPlayerCount()
        if tonumber(players) > 0 then   -- 1 a 2 játékos 
            setElementFrozen(source, true)
            setPedAnimation(source , "rob_bank", "cat_safe_rob", 30000, true, true, true, false) 
            setTimer(setElementFrozen,30000,1,source,false)
            randomM = math.random(0,150000)
            setTimer(function()
            givePlayerMoney(source,randomM)
            end,30000,1)
            setTimer(outputChatBox, 1000, 1,"#00B4FF"..getPlayerName(source).." #ffffffelkezdte rabolni a(z) #6F9F86Las Venturas, Las Venturas - benzinkutat.",root,255,255,255,true)
            setTimer(outputChatBox, 30000,1,"#00B4FF"..getPlayerName(source).." #ffffffVégzett a boltrablással. Összesen rabolt #007DFA"..randomM.." #ffffffdollárt.",root,255,255,255,true)
            setTimer(outputChatBox, 900000, 1,"#6F9F86Las Venturas, Las Venturas - benzinkút újra rabolható!",root,255,255,255,true)
            setTimer(Boltrablas,3600000,1) --< Óránként csinál rablást >--
            destroyElement(robmarker1)
            destroyElement(blip)
        else
            outputChatBox(" Legalább 2 játékosnak kell lennie a szerveren.",source,255,255,255,true)
        return end 
    else
        outputChatBox(" Ezt a parancsot csak bolt markerben használhatod.",source,255,255,255,true)
    end
end
addCommandHandler("rob",boltrablas)

 

i changed the "Boltrablas" timer, and marker why not show again?

Link to comment

onResourceStart don't have any meaning because 
if you didn't make the codes in function it will automatic do it on resource start
so just delete the event on resource start and the function like before

 

	rablashelye = createMarker ( 252.3,-54.6,0.9, "cylinder", 1, 255, 255, 255, 170 )
	outputChatBox("A kisboltot újra kitudjátok rabolni", root, r,g,b,true)

with no events or functions it will do it on resource start

Edited by 3laa33
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...