Jump to content

why my button doesnt work ?


Recommended Posts

my button doesnt work , the element doesnt destroy D:

---------Client------------ 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.36,0.225,0.2412,0.6017,"GUI Blips",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Image[1] = guiCreateStaticImage(34,63,31,26,"images/Blip58.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(69,63,105,28,"Buy Blip58",false,GUIEditor_Window[1]) 
GUIEditor_Image[2] = guiCreateStaticImage(33,106,32,30,"images/Blip59.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(69,108,105,28,"Buy Blip59",false,GUIEditor_Window[1]) 
GUIEditor_Image[3] = guiCreateStaticImage(33,151,32,32,"images/Blip60.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(69,157,105,28,"Buy Blip60",false,GUIEditor_Window[1]) 
GUIEditor_Image[4] = guiCreateStaticImage(33,204,32,31,"images/Blip61.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(69,208,105,28,"Buy Blip61",false,GUIEditor_Window[1]) 
GUIEditor_Image[5] = guiCreateStaticImage(33,253,32,27,"images/Blip62.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(69,255,105,28,"Buy Blip62",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(31,292,149,18,"GUI Blips by ElMota",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
GUIEditor_Button[6] = guiCreateButton(68,322,108,28,"Usar el de defecto",false,GUIEditor_Window[1]) 
  
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
  
bindKey("F7","down",  
function() 
guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) 
showCursor(guiGetVisible(GUIEditor_Window[1])) 
end 
) 
  
addEventHandler("onClientMouseEnter", root,  
function() 
if source == GUIEditor_Button[1] then 
guiSetText(GUIEditor_Label[1], "Price : 6000") 
guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
elseif source == GUIEditor_Button[2] then 
guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
guiSetText(GUIEditor_Label[1], "Price : 6000") 
elseif source == GUIEditor_Button[3] then 
guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
guiSetText(GUIEditor_Label[1], "Price : 6000") 
elseif source == GUIEditor_Button[4] then 
guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
guiSetText(GUIEditor_Label[1], "Price : 6000") 
elseif source == GUIEditor_Button[5] then 
guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
guiSetText(GUIEditor_Label[1], "Price : 6000") 
end 
end 
) 
  
addEventHandler("onClientMouseLeave", root,  
function() 
if source == GUIEditor_Button[1] then 
guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
elseif source == GUIEditor_Button[2] then 
guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
elseif source == GUIEditor_Button[3] then 
guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
elseif source == GUIEditor_Button[4] then 
guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
elseif source == GUIEditor_Button[5] then 
guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
end 
end 
) 
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == GUIEditor_Button[1] then 
triggerServerEvent("comprarBlip1", getLocalPlayer()) 
elseif source == GUIEditor_Button[2] then 
triggerServerEvent("comprarBlip2", getLocalPlayer()) 
elseif source == GUIEditor_Button[3] then 
triggerServerEvent("comprarBlip3", getLocalPlayer()) 
elseif source == GUIEditor_Button[4] then 
triggerServerEvent("comprarBlip4", getLocalPlayer()) 
elseif source == GUIEditor_Button[5] then 
triggerServerEvent("comprarBlip5", getLocalPlayer()) 
elseif source == GUIEditor_Button[6] then 
triggerServerEvent("comprarBlip6", getLocalPlayer()) 
end 
end 
) 

-------------Server--------- 
function cb1 ( ) 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
    destroyElement("blip2") 
    destroyElement("blip3") 
    destroyElement("blip4") 
    destroyElement("blip5") 
    blip1 = createBlipAttachedTo( source, 58 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
            destroyElement("blip2") 
            destroyElement("blip3") 
            destroyElement("blip4") 
            destroyElement("blip5") 
            blip1 = createBlipAttachedTo( source, 58 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip1", true ) 
addEventHandler( "comprarBlip1", getRootElement(), cb1 ) 
  
function cb2() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement("blip1") 
destroyElement("blip3") 
destroyElement("blip4") 
destroyElement("blip5") 
blip2 = createBlipAttachedTo( source, 59 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement("blip1") 
destroyElement("blip3") 
destroyElement("blip4") 
destroyElement("blip5") 
blip2 = createBlipAttachedTo( source, 59 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip2", true ) 
addEventHandler( "comprarBlip2", getRootElement(), cb2 ) 
  
function cb3() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement("blip1") 
destroyElement("blip2") 
destroyElement("blip4") 
destroyElement("blip5") 
blip3 = createBlipAttachedTo( source, 60 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement("blip1") 
destroyElement("blip2") 
destroyElement("blip4") 
destroyElement("blip5") 
blip3 = createBlipAttachedTo( source, 60 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip3", true ) 
addEventHandler( "comprarBlip3", getRootElement(), cb3 ) 
  
function cb4() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement("blip1") 
destroyElement("blip2") 
destroyElement("blip3") 
destroyElement("blip5") 
blip4 = createBlipAttachedTo( source, 61 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement("blip1") 
destroyElement("blip2") 
destroyElement("blip3") 
destroyElement("blip5") 
blip4 = createBlipAttachedTo( source, 61 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip4", true ) 
addEventHandler( "comprarBlip4", getRootElement(), cb4 ) 
  
function cb5() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement("blip1") 
destroyElement("blip2") 
destroyElement("blip3") 
destroyElement("blip4") 
blip5 = createBlipAttachedTo( source, 62 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement("blip1") 
destroyElement("blip2") 
destroyElement("blip3") 
destroyElement("blip4") 
blip5 = createBlipAttachedTo( source, 62 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip5", true ) 
addEventHandler( "comprarBlip5", getRootElement(), cb5 ) 
  
function cb6() 
destroyElement("blip1") 
destroyElement("blip2") 
destroyElement("blip3") 
destroyElement("blip4") 
destroyElement("blip5") 
end 
addEvent( "comprarBlip6", true ) 
addEventHandler( "comprarBlip6", getRootElement(), cb6 ) 

please help me :)

Link to comment

try this:

---------Client------------ 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.36,0.225,0.2412,0.6017,"GUI Blips",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Image[1] = guiCreateStaticImage(34,63,31,26,"images/Blip58.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(69,63,105,28,"Buy Blip58",false,GUIEditor_Window[1]) 
GUIEditor_Image[2] = guiCreateStaticImage(33,106,32,30,"images/Blip59.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(69,108,105,28,"Buy Blip59",false,GUIEditor_Window[1]) 
GUIEditor_Image[3] = guiCreateStaticImage(33,151,32,32,"images/Blip60.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(69,157,105,28,"Buy Blip60",false,GUIEditor_Window[1]) 
GUIEditor_Image[4] = guiCreateStaticImage(33,204,32,31,"images/Blip61.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(69,208,105,28,"Buy Blip61",false,GUIEditor_Window[1]) 
GUIEditor_Image[5] = guiCreateStaticImage(33,253,32,27,"images/Blip62.png",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(69,255,105,28,"Buy Blip62",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(31,292,149,18,"GUI Blips by ElMota",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
GUIEditor_Button[6] = guiCreateButton(68,322,108,28,"Usar el de defecto",false,GUIEditor_Window[1]) 
  
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
  
bindKey("F7","down",function() 
guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) 
showCursor(not isCursorShowing()) 
end) 
  
addEventHandler("onClientMouseEnter", guiRoot, 
function() 
    if source == GUIEditor_Button[1] then 
        guiSetText(GUIEditor_Label[1], "Price : 6000") 
        guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
    elseif source == GUIEditor_Button[2] then 
        guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
        guiSetText(GUIEditor_Label[1], "Price : 6000") 
    elseif source == GUIEditor_Button[3] then 
        guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
        guiSetText(GUIEditor_Label[1], "Price : 6000") 
    elseif source == GUIEditor_Button[4] then 
        guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
        guiSetText(GUIEditor_Label[1], "Price : 6000") 
    elseif source == GUIEditor_Button[5] then 
        guiLabelSetColor(GUIEditor_Label[1], 0, 0, 255) 
        guiSetText(GUIEditor_Label[1], "Price : 6000") 
    end 
end) 
  
addEventHandler("onClientMouseLeave", guiRoot,function() 
    if source == GUIEditor_Button[1] then 
        guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
        guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
    elseif source == GUIEditor_Button[2] then 
        guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
        guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
    elseif source == GUIEditor_Button[3] then 
        guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
        guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
    elseif source == GUIEditor_Button[4] then 
        guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
        guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
    elseif source == GUIEditor_Button[5] then 
        guiLabelSetColor(GUIEditor_Label[1], 255, 255, 0) 
        guiSetText(GUIEditor_Label[1], "GUI Blips by ElMota") 
    end 
end) 
  
addEventHandler("onClientGUIClick",guiRoot,function() 
    if source == GUIEditor_Button[1] then 
        triggerServerEvent("comprarBlip1", getLocalPlayer()) 
    elseif source == GUIEditor_Button[2] then 
        triggerServerEvent("comprarBlip2", getLocalPlayer()) 
    elseif source == GUIEditor_Button[3] then 
        triggerServerEvent("comprarBlip3", getLocalPlayer()) 
    elseif source == GUIEditor_Button[4] then 
        triggerServerEvent("comprarBlip4", getLocalPlayer()) 
    elseif source == GUIEditor_Button[5] then 
        triggerServerEvent("comprarBlip5", getLocalPlayer()) 
    elseif source == GUIEditor_Button[6] then 
        triggerServerEvent("comprarBlip6", getLocalPlayer()) 
    end 
end) 

-------------Server--------- 
function cb1 ( ) 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
    destroyElement(blip2) 
    destroyElement(blip3) 
    destroyElement(blip4) 
    destroyElement(blip5) 
    blip1 = createBlipAttachedTo( source, 58 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
            destroyElement(blip2) 
            destroyElement(blip3) 
            destroyElement(blip4) 
            destroyElement(blip5) 
            blip1 = createBlipAttachedTo( source, 58 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip1", true ) 
addEventHandler( "comprarBlip1", getRootElement(), cb1 ) 
  
function cb2() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement("blip1") 
destroyElement("blip3") 
destroyElement("blip4") 
destroyElement("blip5") 
blip2 = createBlipAttachedTo( source, 59 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement("blip1") 
destroyElement("blip3") 
destroyElement("blip4") 
destroyElement("blip5") 
blip2 = createBlipAttachedTo( source, 59 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip2", true ) 
addEventHandler( "comprarBlip2", getRootElement(), cb2 ) 
  
function cb3() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement(blip1) 
destroyElement(blip2) 
destroyElement(blip4) 
destroyElement(blip5) 
blip3 = createBlipAttachedTo( source, 60 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement(blip1) 
destroyElement(blip2) 
destroyElement(blip4) 
destroyElement(blip5) 
blip3 = createBlipAttachedTo( source, 60 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip3", true ) 
addEventHandler( "comprarBlip3", getRootElement(), cb3 ) 
  
function cb4() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement(blip1) 
destroyElement(blip2) 
destroyElement(blip3) 
destroyElement(blip5) 
blip4 = createBlipAttachedTo( source, 61 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement(blip1) 
destroyElement(blip2) 
destroyElement(blip3) 
destroyElement(blip5) 
blip4 = createBlipAttachedTo( source, 61 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip4", true ) 
addEventHandler( "comprarBlip4", getRootElement(), cb4 ) 
  
function cb5() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "~ElMota~" then 
destroyElement(blip1) 
destroyElement(blip2) 
destroyElement(blip3) 
destroyElement(blip4) 
blip5 = createBlipAttachedTo( source, 62 ) 
    else 
        if ( money >= 6000 ) then 
            takePlayerMoney ( source, 6000 ) 
destroyElement(blip1) 
destroyElement(blip2) 
destroyElement(blip3) 
destroyElement(blip4) 
blip5 = createBlipAttachedTo( source, 62 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "comprarBlip5", true ) 
addEventHandler( "comprarBlip5", getRootElement(), cb5 ) 
  
function cb6() 
destroyElement(blip1) 
destroyElement(blip2) 
destroyElement(blip3) 
destroyElement(blip4) 
destroyElement(blip5) 
end 
addEvent( "comprarBlip6", true ) 
addEventHandler( "comprarBlip6", getRootElement(), cb6 ) 

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