Jump to content

Please Help


Recommended Posts

Posted

hi guys i have problem with this script

the problem is if i hit the 2nd marker (myMarker2 ) the (ProgressBar2) does not shows

this script is delivery goods job

sorry about my bad english

this is client

  
Goods_Job_Window = guiCreateWindow(344, 196, 362, 385, "Goods Job", false) 
        guiWindowSetSizable(Goods_Job_Window, false) 
        guiSetVisible(Goods_Job_Window, false) 
        guiSetAlpha(Goods_Job_Window, 0.86) 
  
Goods_Job_Botton1 = guiCreateButton(44, 52, 100, 98, "", false, Goods_Job_Window) 
Goods_Job_Image1 = guiCreateStaticImage(44, 52, 100, 98, ":guieditor/images/image1.png", false, Goods_Job_Window) 
Goods_Job_Close_Window = guiCreateButton(9, 333, 344, 42, "X", false, Goods_Job_Window)     
         
        ProgressBar1 = guiCreateProgressBar(271, 301, 480, 65, false) 
        guiSetVisible(ProgressBar1, false) 
        ProgressBar2 = guiCreateProgressBar(271, 301, 480, 65, false) 
        guiSetVisible(ProgressBar2, false) 
  
local myMarker = createMarker(2492.75830, -1667.61365, 12.34375, 'cylinder', 2.0, 255, 0, 0, 150)  
  
function MarkerHit()  
    if source == myMarker then 
    guiSetVisible(Goods_Job_Window, true) 
    showCursor(true) 
  
end 
end 
addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) 
  
  
  
  
function on_MyGoodsJob_Click() 
  if source == Goods_Job_Close_Window then 
    guiSetVisible(Goods_Job_Window, false) 
    showCursor(false) 
    end 
    end 
addEventHandler("onClientGUIClick", resourceRoot, on_MyGoodsJob_Click) 
     
function on_MyGoodsJob_Porgess()     
  if source == Goods_Job_Botton1 then 
  guiSetVisible(ProgressBar1, true) 
  guiSetVisible(Goods_Job_Window, false) 
  showCursor(true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar1, 20) outputChatBox("Please Wait 5 Second",255,255,0) end,1000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar1, 40) outputChatBox("Please Wait 4 Second",255,255,0) end,2000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar1, 60) outputChatBox("Please Wait 3 Second",255,255,0) end,3000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar1, 80) outputChatBox("Please Wait 2 Second",255,255,0) end,4000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar1, 100) outputChatBox("Please Wait 1 Second",255,255,0) end,5000,1, true) 
    setTimer(function () 
    local myMarker2 = createMarker(2482.75830, -1667.61365, 12.34375, 'cylinder', 2.0, 255, 0, 0, 150)   
    guiSetVisible(ProgressBar1, false) 
    showCursor(false) 
    createBlip ( 2482.75830, -1667.61365, 12.34375, 41) 
    outputChatBox("Go to Red Blip",255,255,0) 
    removeEventHandler("onClientMarkerHit", getRootElement(), MarkerHit) 
    end,6000,1, true) 
     
     
     
    end 
     
     
    end 
addEventHandler("onClientGUIClick", resourceRoot, on_MyGoodsJob_Porgess) 
  
function MarkerHit2()  
    if source == myMarker2 then 
    guiSetVisible(ProgressBar2, true) 
    showCursor(true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 20) outputChatBox("Please Wait 10 Second",255,255,0) end,2000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 40) outputChatBox("Please Wait 8 Second",255,255,0) end,4000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 60) outputChatBox("Please Wait 6 Second",255,255,0) end,6000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 80) outputChatBox("Please Wait 4 Second",255,255,0) end,8000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 100) outputChatBox("Please Wait 2 Second",255,255,0) end,10000,1, true) 
    setTimer(function ()  
    local Player = getLocalPlayer()    
    guiSetVisible(ProgressBar2, false)  
    showCursor(false)  
    setElementData(Player, "Money", (getElementData(Player, "Money") or 0) + 2000) 
    outputChatBox("You Get 2000$",255,255,0) end,12000,1, true) 
    destroyElement(myMarker2)   
     
end 
end 
addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit2) 
  
  
  
  
  

Posted

Simply because "myMarker2" it's a local variable.

try this

addEventHandler("onClientResourceStart",resourceRoot, 
function() 
    Goods_Job_Window = guiCreateWindow(344, 196, 362, 385, "Goods Job", false) 
    guiWindowSetSizable(Goods_Job_Window, false) 
    guiSetVisible(Goods_Job_Window, false) 
    guiSetAlpha(Goods_Job_Window, 0.86) 
    Goods_Job_Botton1 = guiCreateButton(44, 52, 100, 98, "", false, Goods_Job_Window) 
    Goods_Job_Image1 = guiCreateStaticImage(44, 52, 100, 98, ":guieditor/images/image1.png", false, Goods_Job_Window) 
    Goods_Job_Close_Window = guiCreateButton(9, 333, 344, 42, "X", false, Goods_Job_Window)     
    ProgressBar1 = guiCreateProgressBar(271, 301, 480, 65, false) 
    guiSetVisible(ProgressBar1, false) 
    ProgressBar2 = guiCreateProgressBar(271, 301, 480, 65, false) 
    guiSetVisible(ProgressBar2, false) 
    addEventHandler("onClientGUIClick",Goods_Job_Close_Window,on_MyGoodsJob_Click,false) 
    addEventHandler("onClientGUIClick",Goods_Job_Botton1, on_MyGoodsJob_Porgess) 
     
end  
) 
  
local myMarker = createMarker(2492.75830, -1667.61365, 12.34375, 'cylinder', 2.0, 255, 0, 0, 150) 
  
function MarkerHit() 
    if source == myMarker then 
    guiSetVisible(Goods_Job_Window, true) 
    showCursor(true) 
    end 
end 
addEventHandler ( "onClientMarkerHit",myMarker, MarkerHit ) 
  
  
function on_MyGoodsJob_Click() 
  if source == Goods_Job_Close_Window then 
    guiSetVisible(Goods_Job_Window, false) 
    showCursor(false) 
    end 
end 
  
    
function on_MyGoodsJob_Porgess()    
    if source == Goods_Job_Botton1 then 
        guiSetVisible(ProgressBar1, true) 
        guiSetVisible(Goods_Job_Window, false) 
        showCursor(true) 
        setTimer(function () guiProgressBarSetProgress(ProgressBar1, 20) outputChatBox("Please Wait 5 Second",255,255,0) end,1000,1, true) 
        setTimer(function () guiProgressBarSetProgress(ProgressBar1, 40) outputChatBox("Please Wait 4 Second",255,255,0) end,2000,1, true) 
        setTimer(function () guiProgressBarSetProgress(ProgressBar1, 60) outputChatBox("Please Wait 3 Second",255,255,0) end,3000,1, true) 
        setTimer(function () guiProgressBarSetProgress(ProgressBar1, 80) outputChatBox("Please Wait 2 Second",255,255,0) end,4000,1, true) 
        setTimer(function () guiProgressBarSetProgress(ProgressBar1, 100) outputChatBox("Please Wait 1 Second",255,255,0) end,5000,1, true) 
        setTimer(function () 
        myMarker2 = createMarker(2482.75830, -1667.61365, 12.34375, 'cylinder', 2.0, 255, 0, 0, 150)  
        guiSetVisible(ProgressBar1, false) 
        showCursor(false) 
        createBlip ( 2482.75830, -1667.61365, 12.34375, 41) 
        outputChatBox("Go to Red Blip",255,255,0) 
        addEventHandler ( "onClientMarkerHit",myMarker2, MarkerHit2) 
        end,6000,1, true) 
    end 
end 
  
  
function MarkerHit2() 
    if source == myMarker2 then 
    guiSetVisible(ProgressBar2, true) 
    showCursor(true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 20) outputChatBox("Please Wait 10 Second",255,255,0) end,2000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 40) outputChatBox("Please Wait 8 Second",255,255,0) end,4000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 60) outputChatBox("Please Wait 6 Second",255,255,0) end,6000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 80) outputChatBox("Please Wait 4 Second",255,255,0) end,8000,1, true) 
    setTimer(function () guiProgressBarSetProgress(ProgressBar2, 100) outputChatBox("Please Wait 2 Second",255,255,0) end,10000,1, true) 
    setTimer(function () 
    local Player = getLocalPlayer()   
    guiSetVisible(ProgressBar2, false) 
    showCursor(false) 
    setElementData(Player, "Money", (getElementData(Player, "Money") or 0) + 2000) 
    outputChatBox("You Get 2000$",255,255,0) end,12000,1, true) 
    destroyElement(myMarker2)   
    end 
end 
  

Fixed full code.

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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...