X-SHADOW Posted May 20, 2012 Share Posted May 20, 2012 Hi all i have made this script but it didn't work ClientSide GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(420,259,582,358,"Stats_Manger By 'Dev-PoinT' v1.0",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_TabPanel[1] = guiCreateTabPanel(9,17,564,330,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Reset Mangement",GUIEditor_TabPanel[1]) GUIEditor_Image[1] = guiCreateStaticImage(11,1,174,107,"images/Controll.png",false,GUIEditor_Tab[1]) GUIEditor_Button[1] = guiCreateButton(82,133,124,32,"Dmg",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(86,182,124,34,"Damage",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Button[3] = guiCreateButton(249,133,121,37,"Kills",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[3],"clear-normal") GUIEditor_Button[4] = guiCreateButton(395,136,133,32,"Deaths",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[4],"clear-normal") GUIEditor_Button[5] = guiCreateButton(246,182,130,34,"Money",false,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Help Mangement",GUIEditor_TabPanel[1]) GUIEditor_Memo[1] = guiCreateMemo(9,5,554,297,"\n#1 First tab use for resert your Dmg - Damage Kills- Deaths -Money To [ 0 ] |\n\n#2 Help Mangemnet You Can Put what you want By Make guiSetMemo read only (false) and type what you want then set it to (true).\n\n'Dev-PoinT Development.\n\nThank's",false,GUIEditor_Tab[2]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Tab[3] = guiCreateTab("V.I.P Mangment",GUIEditor_TabPanel[1]) GUIEditor_Button[6] = guiCreateButton(385,259,141,31,"give Money $ 1000",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[6],"clear-normal") GUIEditor_Image[2] = guiCreateStaticImage(358,183,180,54,"images/Dollars.png",false,GUIEditor_Tab[3]) GUIEditor_Button[7] = guiCreateButton(371,86,153,34,"M4 $ 500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[7],"clear-normal") GUIEditor_Image[3] = guiCreateStaticImage(358,13,157,65,"images/7.png",false,GUIEditor_Tab[3]) GUIEditor_Button[8] = guiCreateButton(12,260,137,32,"Greande $ 2500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[8],"clear-normal") GUIEditor_Image[4] = guiCreateStaticImage(1,189,159,73,"images/1.png",false,GUIEditor_Tab[3]) GUIEditor_Label[1] = guiCreateLabel(187,17,137,15,"Buy Weapons ",false,GUIEditor_Tab[3]) guiLabelSetColor(GUIEditor_Label[1],0,255,255) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Image[5] = guiCreateStaticImage(10,15,146,127,"images/DecentGun.png",false,GUIEditor_Tab[3]) function open() if (guiGetVisible(GUIEditor_Window[1]) == true) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end bindKey("F6","down",open) function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end addEventHandler('onClientGUIClicl', getRootElement(), function (button, state, absoluteX, absoluteY) if ( source == GUIEditor_Button[7] ) then triggerServerEvent('giveM',getLocalPlayer()) elseif ( source == GUIEditor_Button[8] ) then triggerServerEvent('giveG',getLocalPlayer()) elseif ( source == GUIEditor_Button[1] ) then setElementData(source, 'Dmg', 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[2] ) then setElementData( source, 'Damage', 0) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[3] ) then setElementData(source, 'Kills', 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[4] ) then setElementData(source,'Deaths', 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[5] ) then setPlayerMoney(source, 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[ 6] ) then givePlayerMoney( source , 100) outputChatBox('successfully Payed !',source,255 , 255, 0) end end) ServerSide addEvent('giveM', true) addEventHandler('giveM',root, function() local money = getPlayerMoney(source) if ( money >= 500 ) then takePlayerMoney(source, money) giveWeapon ( source, 31 , 200 ) outputChatBox(getPlayerName(source) .. 'Bought M4') else outputChatBox('You Dont Have Enough Money To Buy This',source, 255, 255, 0 ) end end) addEvent('giveG', true) addEventHandler('giveG',root, function() local money = getPlayerMoney(source) if ( money >= 2500 ) then takePlayerMoney(source, money) giveWeapon ( source, 16 , 5 ) outputChatBox(getPlayerName(source) .. 'Bought Greande') else outputChatBox('You Dont Have Enough Money To Buy This',source, 255, 255, 0 ) end end) addEventHanlder('onResourceStart', resourceRoot, function() outputChatBox('Press F6 To Open Your Stats_Mangment !',255,255,0) end) Link to comment
Stanley Sathler Posted May 20, 2012 Share Posted May 20, 2012 You must tell us: why did not work? The GUI isn't showed, certain function isn't called...? Link to comment
X-SHADOW Posted May 20, 2012 Author Share Posted May 20, 2012 its say server.lua:27 addEventHandler a nill value and when i press the buttons dont do any thing . Link to comment
Jaysds1 Posted May 20, 2012 Share Posted May 20, 2012 You have multiple errors here, Client-side: addEventHanlder('onClientResourceStart', resourceRoot,function() --moved to client-side outputChatBox('Press F6 To Open Your Stats_Mangment !',255,255,0) centerWindow(GUIEditor_Window[1]) --forgot to call if gui is visible guiSetVisible(GUIEditor_Window[1],false) end) GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(420,259,582,358,"Stats_Manger By 'Dev-PoinT' v1.0",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_TabPanel[1] = guiCreateTabPanel(9,17,564,330,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Reset Mangement",GUIEditor_TabPanel[1]) GUIEditor_Image[1] = guiCreateStaticImage(11,1,174,107,"images/Controll.png",false,GUIEditor_Tab[1]) GUIEditor_Button[1] = guiCreateButton(82,133,124,32,"Dmg",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(86,182,124,34,"Damage",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Button[3] = guiCreateButton(249,133,121,37,"Kills",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[3],"clear-normal") GUIEditor_Button[4] = guiCreateButton(395,136,133,32,"Deaths",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[4],"clear-normal") GUIEditor_Button[5] = guiCreateButton(246,182,130,34,"Money",false,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Help Mangement",GUIEditor_TabPanel[1]) GUIEditor_Memo[1] = guiCreateMemo(9,5,554,297,"\n#1 First tab use for resert your Dmg - Damage Kills- Deaths -Money To [ 0 ] |\n\n#2 Help Mangemnet You Can Put what you want By Make guiSetMemo read only (false) and type what you want then set it to (true).\n\n'Dev-PoinT Development.\n\nThank's",false,GUIEditor_Tab[2]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Tab[3] = guiCreateTab("V.I.P Mangment",GUIEditor_TabPanel[1]) GUIEditor_Button[6] = guiCreateButton(385,259,141,31,"give Money $ 1000",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[6],"clear-normal") GUIEditor_Image[2] = guiCreateStaticImage(358,183,180,54,"images/Dollars.png",false,GUIEditor_Tab[3]) GUIEditor_Button[7] = guiCreateButton(371,86,153,34,"M4 $ 500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[7],"clear-normal") GUIEditor_Image[3] = guiCreateStaticImage(358,13,157,65,"images/7.png",false,GUIEditor_Tab[3]) GUIEditor_Button[8] = guiCreateButton(12,260,137,32,"Greande $ 2500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[8],"clear-normal") GUIEditor_Image[4] = guiCreateStaticImage(1,189,159,73,"images/1.png",false,GUIEditor_Tab[3]) GUIEditor_Label[1] = guiCreateLabel(187,17,137,15,"Buy Weapons ",false,GUIEditor_Tab[3]) guiLabelSetColor(GUIEditor_Label[1],0,255,255) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Image[5] = guiCreateStaticImage(10,15,146,127,"images/DecentGun.png",false,GUIEditor_Tab[3]) function open() --made the function shorter guiSetVisible(GUIEditor_Window[1],not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end bindKey("F6","down",open) function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end addEventHandler('onClientGUIClick',guiRoot,function(button, state) --the absolute's are not needed as the buttons are on the gui if ( source == GUIEditor_Button[7] ) then triggerServerEvent('giveM',getLocalPlayer()) elseif ( source == GUIEditor_Button[8] ) then triggerServerEvent('giveG',getLocalPlayer()) elseif ( source == GUIEditor_Button[1] ) then setElementData(source, 'Dmg', 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[2] ) then setElementData( source, 'Damage', 0) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[3] ) then setElementData(source, 'Kills', 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[4] ) then setElementData(source,'Deaths', 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[5] ) then setPlayerMoney(source, 0 ) outputChatBox('successfully reset!',source,255 , 255, 0) elseif ( source == GUIEditor_Button[ 6] ) then givePlayerMoney( source , 100) outputChatBox('successfully Payed !',source,255 , 255, 0) end end,true)-- Forgot to add a boolean for the event (required) Server-side: addEvent('giveM', true) addEventHandler('giveM',root,function() local money = getPlayerMoney(source) if ( money >= 500 ) then takePlayerMoney(source, money) giveWeapon ( source, 31 , 200 ) outputChatBox(getPlayerName(source) .. 'Bought M4') else outputChatBox('You Dont Have Enough Money To Buy This',source, 255, 255, 0 ) end end) addEvent('giveG', true) addEventHandler('giveG',root,function() local money = getPlayerMoney(source) if ( money >= 2500 ) then takePlayerMoney(source, money) giveWeapon ( source, 16 , 5 ) outputChatBox(getPlayerName(source) .. 'Bought Greande') else outputChatBox('You Dont Have Enough Money To Buy This',source, 255, 255, 0 ) end end) Link to comment
Alpha Posted May 20, 2012 Share Posted May 20, 2012 Client: addEventHandler('onClientResourceStart', resourceRoot,function() --moved to client-side outputChatBox('Press F6 To Open Your Stats_Mangment !',255,255,0) centerWindow(GUIEditor_Window[1]) --forgot to call if gui is visible guiSetVisible(GUIEditor_Window[1],false) end) GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(420,259,582,358,"Stats_Manger By 'Dev-PoinT' v1.0",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_TabPanel[1] = guiCreateTabPanel(9,17,564,330,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Reset Mangement",GUIEditor_TabPanel[1]) GUIEditor_Image[1] = guiCreateStaticImage(11,1,174,107,"images/Controll.png",false,GUIEditor_Tab[1]) GUIEditor_Button[1] = guiCreateButton(82,133,124,32,"Dmg",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(86,182,124,34,"Damage",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Button[3] = guiCreateButton(249,133,121,37,"Kills",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[3],"clear-normal") GUIEditor_Button[4] = guiCreateButton(395,136,133,32,"Deaths",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[4],"clear-normal") GUIEditor_Button[5] = guiCreateButton(246,182,130,34,"Money",false,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Help Mangement",GUIEditor_TabPanel[1]) GUIEditor_Memo[1] = guiCreateMemo(9,5,554,297,"\n#1 First tab use for resert your Dmg - Damage Kills- Deaths -Money To [ 0 ] |\n\n#2 Help Mangemnet You Can Put what you want By Make guiSetMemo read only (false) and type what you want then set it to (true).\n\n'Dev-PoinT Development.\n\nThank's",false,GUIEditor_Tab[2]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Tab[3] = guiCreateTab("V.I.P Mangment",GUIEditor_TabPanel[1]) GUIEditor_Button[6] = guiCreateButton(385,259,141,31,"give Money $ 1000",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[6],"clear-normal") GUIEditor_Image[2] = guiCreateStaticImage(358,183,180,54,"images/Dollars.png",false,GUIEditor_Tab[3]) GUIEditor_Button[7] = guiCreateButton(371,86,153,34,"M4 $ 500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[7],"clear-normal") GUIEditor_Image[3] = guiCreateStaticImage(358,13,157,65,"images/7.png",false,GUIEditor_Tab[3]) GUIEditor_Button[8] = guiCreateButton(12,260,137,32,"Greande $ 2500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[8],"clear-normal") GUIEditor_Image[4] = guiCreateStaticImage(1,189,159,73,"images/1.png",false,GUIEditor_Tab[3]) GUIEditor_Label[1] = guiCreateLabel(187,17,137,15,"Buy Weapons ",false,GUIEditor_Tab[3]) guiLabelSetColor(GUIEditor_Label[1],0,255,255) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Image[5] = guiCreateStaticImage(10,15,146,127,"images/DecentGun.png",false,GUIEditor_Tab[3]) function open() --made the function shorter guiSetVisible(GUIEditor_Window[1],not guiGetVisible(GUIEditor_Window[1])) showCursor(guiGetVisible(GUIEditor_Window[1])) end bindKey("F6","down",open) function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end addEventHandler('onClientGUIClick',guiRoot,function(button, state) --the absolute's are not needed as the buttons are on the gui if ( source == GUIEditor_Button[7] ) then triggerServerEvent('giveM',localPlayer) elseif ( source == GUIEditor_Button[8] ) then triggerServerEvent('giveG',localPlayer) elseif ( source == GUIEditor_Button[1] ) then setElementData(localPlayer, 'Dmg', 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[2] ) then setElementData( localPlayer, 'Damage', 0) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[3] ) then setElementData(localPlayer, 'Kills', 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[4] ) then setElementData(localPlayer,'Deaths', 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[5] ) then setPlayerMoney(localPlayer, 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[ 6] ) then givePlayerMoney( localPlayer , 100) outputChatBox('successfully Payed !',255 , 255, 0) end end,true)-- Forgot to add a boolean for the event (required) Link to comment
X-SHADOW Posted May 20, 2012 Author Share Posted May 20, 2012 Can Some One show me example how to play sound when gui open ? Link to comment
Jaysds1 Posted May 20, 2012 Share Posted May 20, 2012 There's no way to play a sound for every gui that pops up, unless you add it your self... Link to comment
X-SHADOW Posted May 20, 2012 Author Share Posted May 20, 2012 i want when the player open the window play sound i have the sound but how to make it can you show me example Link to comment
Jaysds1 Posted May 20, 2012 Share Posted May 20, 2012 ok, guiSetVisible(GUI,true) playSound("Sound.mp3",false) Link to comment
X-SHADOW Posted May 21, 2012 Author Share Posted May 21, 2012 now i have problem with setPlayerMoney and givePlayerMoney triggerServerEvent addEvent('giveM', true) addEventHandler('giveM',root,function() local money = getPlayerMoney(source) if ( money >= 500 ) then takePlayerMoney(source, money) giveWeapon ( source, 31 , 200 ) outputChatBox(getPlayerName(source) .. 'Bought M4') else outputChatBox('You Dont Have Enough Money To Buy This',source, 255, 255, 0 ) end end) addEvent('giveG', true) addEventHandler('giveG',root,function() local money = getPlayerMoney(source) if ( money >= 2500 ) then takePlayerMoney(source, money) giveWeapon ( source, 16 , 5 ) outputChatBox(getPlayerName(source) .. ' Bought Greande ') else outputChatBox('You Dont Have Enough Money To Buy This',source, 255, 255, 0 ) end end) addEvent('giveCash', true) addEventHandler('giveCash',root,function() givePlayerMoney(source, 1000) end) addEvent('setM', true) addEventHandler('setM',root,function() setPlayerMoney(source, 0) end) Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 everything looks ok, can you provide the other script that triggers these events? Link to comment
X-SHADOW Posted May 21, 2012 Author Share Posted May 21, 2012 Thank's Jaysds1 For Help alredy fixed but i want ask some thing i have 9 buttons its possble to make tabel and use it insted of like this for i , .. do 'onClientGUIClick', if [1] = 'Button 1' then etc .. Link to comment
Stanley Sathler Posted May 21, 2012 Share Posted May 21, 2012 Can you explain better, Shadow? Link to comment
X-SHADOW Posted May 21, 2012 Author Share Posted May 21, 2012 like i have 9 buy button right ? i want make a tabl with them and make them work with out if ( source == '' ) then elseif ( source == '' ) then Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 You could either use self addEventHandler's or a group addEventHandler, example: --Self: addEventHandler("onClientGUIClick",button1,button1Function,false) addEventHandler("onClientGUIClick",button2,button2Function,false) --Group addEventHandler("onClientGUIClick",guiRoot,buttonFunction,true) Link to comment
X-SHADOW Posted May 21, 2012 Author Share Posted May 21, 2012 For example like this? function example () button = guiCreateButton ( 10,4,3) (if source == button ) then triggerServerEvent( 'blablabla', localPlayer) addEventHandler("onClientGUIClick",button,example,false) end Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 actually, it's more like this: button = guiCreateButton ( 10,4,3) addEventHandler("onClientGUIClick",button,function() triggerServerEvent( 'blablabla', localPlayer) end) That would create an eventHandler for that button, if you want to create one eventHandler for every button then you would have to do this: button1 = guiCreateButton ( 10,4,3) --Your original button button2 = guiCreateButton ( 15,7,5) addEventHandler("onClientGUIClick",guiRoot,function() if(source == button1)then --If it's button1 triggerServerEvent( 'blablabla', localPlayer) --trigger this event elseif(source == button2)then --else if it's button2 outputChatBox("Please click on the other button to continue") --Tell them to click on the other button else --If they clicked on something else except the buttons then outputChatBox("Please click on one of the buttons provided")--Tell them to click on one of the buttons end end) Link to comment
X-SHADOW Posted May 21, 2012 Author Share Posted May 21, 2012 Ok Thank's Man for This Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now