BriGhtx3 Posted April 1, 2012 Posted April 1, 2012 Hey, I know this topic was created for ~3kkkkk times, but i didn't find any solution. I created a ped like this (EVERYTHING IS CLIENTSIDE): local WeaponPed = createPed(29,296.447265625,-40.435546875,1001.515625) setElementInterior(WeaponPed,1) And now I have a function for clicking the ped: function hans_click(button, state, absX, absY, wx, wy, wz, element) if element == WeaponPed then guiSetVisible(Ammu_Window,true) end end addEventHandler("onClientClick", getRootElement(), hans_click) But the GUI just doesn't show If I remove the line : if element == WeaponPed then the GUI appears. I hope someone can help me^^ Thanks
Castillo Posted April 1, 2012 Posted April 1, 2012 local WeaponPed = createPed ( 29, 296.447265625, -40.435546875, 1001.515625 ) setElementInterior ( WeaponPed, 1 ) function hans_click ( button, state, absX, absY, wx, wy, wz, element ) if ( element and element == WeaponPed ) then guiSetVisible ( Ammu_Window, true ) end end addEventHandler ( "onClientClick", getRootElement(), hans_click )
Castillo Posted April 1, 2012 Posted April 1, 2012 I've clicked the ped and I got a warning saying "Ammu_Window" doesn't exist, which is right. Post your whole code.
BriGhtx3 Posted April 1, 2012 Author Posted April 1, 2012 local WeaponPed = createPed ( 29, 296.447265625, -40.435546875, 1001.515625 ) setElementInterior ( WeaponPed, 1 ) Ammu_Window = guiCreateWindow(350,80,346,592,"Waffen",false) guiWindowSetMovable(Ammu_Window,false) guiWindowSetSizable(Ammu_Window,false) Ammu_LBL_Welcome = guiCreateLabel(42,29,271,62,"Willkommen in der Ammunation-Filliale!\nHier finden Sie Waffen aller Art.\nSuchen Sie sich eine der unten\naufgelisteten Waffen aus und sie gehört Ihnen.",false,Ammu_Window) guiSetFont(Ammu_LBL_Welcome,"default-bold-small") Ammu_LBL_Melee = guiCreateLabel(13,114,43,17,"Melee :",false,Ammu_Window) Ammu_knife = guiCreateStaticImage(77,118,70,70,"images/m.png",false,Ammu_Window) buy_knife = guiCreateButton(65,191,90,19,"Kaufen - 150$",false,Ammu_Window) Ammu_bat = guiCreateStaticImage(188,118,75,70,"images/b.png",false,Ammu_Window) buy_bat = guiCreateButton(183,191,90,19,"Kaufen - 150$",false,Ammu_Window) Ammu_LBL_Pistol = guiCreateLabel(11,224,51,17,"Pistolen :",false,Ammu_Window) guiSetVisible(Ammu_Window,false) function showmedaweapon(player) if guiGetVisible (Ammu_Window) then guiSetVisible(Ammu_Window,false) showCursor(false) else guiSetVisible(Ammu_Window,true) showCursor(true) end end addCommandHandler("ssa",showmedaweapon) function hans_click ( button, state, absX, absY, wx, wy, wz, element ) if ( element and element == WeaponPed ) then guiSetVisible ( Ammu_Window, true ) end end addEventHandler ( "onClientClick", getRootElement(), hans_click ) I can show the GUI via "SSA" but not via clicking
Castillo Posted April 1, 2012 Posted April 1, 2012 Works perfect, when I click on the ped, the ammunation window is appears.
BriGhtx3 Posted April 1, 2012 Author Posted April 1, 2012 It just can't be I also have something like this for a self-menu and it works... I even don't get an error when removing the gui and clicking on the ped
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