Jump to content

Ped onClientClick


BriGhtx3

Recommended Posts

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

Link to comment
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 ) 

Link to comment
  
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

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