Jump to content

Why dont work?


manve1

Recommended Posts

Posted

hey guys, im trying to make a script.. and when i click on Button ( image ) it does nothing... here is LUA

CLIENT:

 gui = guiCreateStaticImage(0,0,1,1,"images/gui.png", true) 
showCursor(true) 
  
army = guiCreateStaticImage( 20, 20, 100, 70, "images/army.png", false, gui )  
  
function army() 
if (source == army) then 
setElementModel(getLocalPlayer(), 287) 
guiSetVisible(gui, false) 
showCursor(false) 
end 
end 
addEventHandler("onClientGUIClick", getRootElement(), army)  

i have no Server side cuz for this script i dont need it... i tihnk that.. PLEASE HELP ME, Thank you.

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted

Try this:

local Gui = {} 
  
Gui["gui_image"] = guiCreateStaticImage(0,0,1,1,"images/gui.png", true) 
    guiSetVisible(Gui["gui_image"], true) 
  
Gui["army_image"] = guiCreateStaticImage( 20, 20, 100, 70, "images/army.png", false, Gui["gui_image"] )  
    guiSetVisible(Gui["army_image"], true) 
     
showCursor(true) 
  
function OnArmyClick() 
    if ( source == Gui["army_image"] ) then 
        setElementModel(localPlayer, 287) 
        guiSetVisible(Gui["gui_image"], false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick", root, OnArmyClick) 

Posted
gui = guiCreateStaticImage(0,0,1,1,"images/gui.png", true) 
showCursor(true) 
  
army = guiCreateStaticImage( 20, 20, 100, 70, "images/army.png", false, gui ) 
  
function army_() 
if (source == army) then 
setElementModel(getLocalPlayer(), 287) 
guiSetVisible(gui, false) 
showCursor(false) 
end 
end 
addEventHandler("onClientGUIClick", getRootElement(), army_) 

Try that, never call a function like a variable/table.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

thats not the whole script.... it has got other pictures too... but this dont work.. and never others for same problem..

and idk what the problem is..

EDIT: Thanx solidsnake, it worked, other one didnt..

Edited by Guest

Looking for tutorials or information? check out: www.simpleask.co.uk

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