Jump to content

Help At gui object


Try

Recommended Posts

Heyo Forum!!!!!!!!!

I need a help at this:

All is working only the objects is not creating and don't attaching

Client:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
  
GUIEditor_Window[1] = guiCreateWindow(950,290,310,199,"Members Commands by Maria",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Button[1] = guiCreateButton(9,28,75,22,"Turtle",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(9,140,75,22,"Love",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(9,112,75,22,"Money",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(9,84,75,22,"Ship",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(9,56,75,22,"Shark",false,GUIEditor_Window[1]) 
GUIEditor_Button[6] = guiCreateButton(9,168,292,22,"Reset",false,GUIEditor_Window[1]) 
GUIEditor_Memo[1] = guiCreateMemo(89,27,208,135,"*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\nCommands Member\n\n* Please don't abuse of any object\n\n* Any bugs tell for one H-Admin\n\n*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-",false,GUIEditor_Window[1]) 
  
function show(source) 
guiSetVisible (GUIEditor_Window,true) 
showCursor(true) 
end 
addCommandHandler("open",show) 
  
function buttons(player, source) 
   if (source == GUIEditor_Button[1]) then 
tiggerServerEvent(source, "turtle",source) 
else 
   if (source == GUIEditor_Button[2]) then 
tiggerServerEvent(source, "love", source) 
else 
   if (source == GUIEditor_Button[3]) then 
tiggerServerEvent(source, "money", source) 
else 
   if (source == GUIEditor_Button[4]) then 
tiggerServerEvent(source, "ship", source) 
else 
   if (source == GUIEditor_Button[5]) then 
tiggerServerEvent(source, "shark", source) 
elseif (source == GUIEditor_Button[6]) then 
tiggerServerEvent(source, "reset", source) 
   end 
  end 
  end 
  end 
  end 
  end 
addEventHandler("onClientGUIClick",getRootElement(),buttons) 
  

Server:

function turtle(source, commandName) 
turtl1 = createObject(1609,0,0,3) 
attachElements(turtl1, source,0,0,0) 
setElementAlpha(source, 0) 
end 
addEvent("turtle",true) 
addEventHandler("turtle",getRootElement(),turtle) 
  
function love(source, commandName) 
love = createObject(1240,0,0,0) 
attachElements(love, source,0,0,1.5) 
setTimer(destroyElement,60000,1,love) 
end 
addEvent("love",true) 
addEventHandler("love",getRootElement(),love) 
  
function money(source, commandName) 
money = createObject(1550,0,0,3) 
attachElements(money, source,0,0,0) 
setElementAlpha(source, 0) 
end 
addEvent("money",true) 
addEventHandler("money",getRootElement(),money) 
  
function ship(source, commandName) 
ship = createObject(8493,0,0,3) 
attachElements(ship, source,0,0,18) 
setElementAlpha(source, 0) 
end 
addEvent("ship",true) 
addEventHandler("ship",getRootElement(),ship) 
  
function shark(source, commandName) 
shark1 = createObject(1608,0,0,3) 
attachElements(shark1, source,0,0,0) 
setElementAlpha(source, 0) 
end 
addEvent("shark",true) 
addEventHandler("shark",getRootElement(),shark) 
  
function reset(source, commandName) 
destroyElement(shark1) 
destroyElement(turtl1) 
destroyElement(money) 
destroyElement(ship) 
destroyElement(love) 
setElementAlpha(source, 255) 
end 
addEvent("reset",true) 
addEventHandler("reset",getRootElement(),reset) 
  

Please don't stole!

Link to comment
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
  
GUIEditor_Window[1] = guiCreateWindow(950,290,310,199,"Members Commands by Maria",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Button[1] = guiCreateButton(9,28,75,22,"Turtle",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(9,140,75,22,"Love",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(9,112,75,22,"Money",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(9,84,75,22,"Ship",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(9,56,75,22,"Shark",false,GUIEditor_Window[1]) 
GUIEditor_Button[6] = guiCreateButton(9,168,292,22,"Reset",false,GUIEditor_Window[1]) 
GUIEditor_Memo[1] = guiCreateMemo(89,27,208,135,"*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\nCommands Member\n\n* Please don't abuse of any object\n\n* Any bugs tell for one H-Admin\n\n*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-",false,GUIEditor_Window[1]) 
  
function show(source) 
guiSetVisible (GUIEditor_Window,true) 
showCursor(true) 
end 
addCommandHandler("open",show) 
  
function buttons(player, source) 
   if (source == GUIEditor_Button[1]) then 
tiggerServerEvent(source, "turtle",source) 
elseif (source == GUIEditor_Button[2]) then 
tiggerServerEvent(source, "love", source) 
elseif (source == GUIEditor_Button[3]) then 
tiggerServerEvent(source, "money", source) 
elseif (source == GUIEditor_Button[4]) then 
tiggerServerEvent(source, "ship", source) 
elseif (source == GUIEditor_Button[5]) then 
tiggerServerEvent(source, "shark", source) 
elseif (source == GUIEditor_Button[6]) then 
tiggerServerEvent(source, "reset", source) 
   end 
  end 
  end 
  end 
  end 
  end 
addEventHandler("onClientGUIClick",getRootElement(),buttons) 

its this yeah but about the indents i don't understand again and the code continue don't showing and attaching the objects

Link to comment

1. because now you got too many ends.

2. also "source" in your function is a button state, because you overwrite the default source.

i dont know how you expect button state (or gui element for that matter) to be the source of an event for the server.

3. TIGGER? tiggerServerEvent?

4. your event arguments for triggerServerEvent are wrong anyway.

5. you are trying to show a TABLE with guiSetVisible (GUIEditor_Window,true), not gonna work.

7. you dont need to put source in server arguments, source is always there. if the event is triggered properly, source will be the player.

8. you're using same names for functions and objects on the server. again, not gonna work.

9. read wiki, please: onClientGUIClick, and all the rest

  
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
localPlayer = getLocalPlayer() 
  
GUIEditor_Window[1] = guiCreateWindow(950,290,310,199,"Members Commands by Maria",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Button[1] = guiCreateButton(9,28,75,22,"Turtle",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(9,140,75,22,"Love",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(9,112,75,22,"Money",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(9,84,75,22,"Ship",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(9,56,75,22,"Shark",false,GUIEditor_Window[1]) 
GUIEditor_Button[6] = guiCreateButton(9,168,292,22,"Reset",false,GUIEditor_Window[1]) 
GUIEditor_Memo[1] = guiCreateMemo(89,27,208,135,"*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\nCommands Member\n\n* Please don't abuse of any object\n\n* Any bugs tell for one H-Admin\n\n*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-",false,GUIEditor_Window[1]) 
  
function show(source) 
  guiSetVisible (GUIEditor_Window[1],true) 
  showCursor(true) 
end 
addCommandHandler("open",show) 
  
  
function buttons(button, state) 
  if (source == GUIEditor_Button[1]) then 
    triggerServerEvent("turtle", localPlayer, localPlayer) 
  elseif (source == GUIEditor_Button[2]) then 
    triggerServerEvent("love", localPlayer, localPlayer) 
  elseif (source == GUIEditor_Button[3]) then 
    triggerServerEvent("money", localPlayer, localPlayer) 
  elseif (source == GUIEditor_Button[4]) then 
    triggerServerEvent("ship", localPlayer, localPlayer) 
  elseif (source == GUIEditor_Button[5]) then 
    triggerServerEvent("shark", localPlayer, localPlayer) 
  elseif (source == GUIEditor_Button[6]) then 
    triggerServerEvent("reset", localPlayer, localPlayer) 
  end 
end 
addEventHandler("onClientGUIClick",getRootElement(),buttons) 

PS: indentation is when each code block (functions/conditions/loops/etc) are visually indented (spaces or tabs at line start),

so you can see when the block starts and where it ends, and what other blocks are in it. something like that.

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