myonlake Posted April 10, 2012 Share Posted April 10, 2012 (edited) Hello, So, I am trying to make a GUI that pops open when a player clicks a dead pedestrian (which is a character killed player), but it seems my debug outputs say it's not an element, how come? local screenx, screeny = guiGetScreenSize() addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if button == "left" and state == "up" then if clickedElement then if getElementType(clickedElement) == "ped" then local ped = clickedElement if getElementData(ped, "ck.ped") then for i,v in ipairs(getElementsByType("p")) do if getElementData(v, "id") == getElementData(ped, "ck.ped") then ck_window = guiCreateWindow((screenx - 773) / 2, (screeny - 393) / 2, 361, 218, "Body", false) guiWindowSetSizable(ck_window, false) ck_memo = guiCreateMemo(16, 32, 329, 139, "Works.", false, ck_window) guiMemoSetReadOnly(ck_memo, true) ck_close = guiCreateButton(16, 178, 331, 25, "Close Window", false, ck_window) guiSetInputEnabled(true) showCursor(true) addEventHandler("onClientGUIClick", ck_close, ckCloseWindow, false) break end end outputChatBox("Works.") else outputChatBox("Not a CK.") end else outputChatBox("Not a ped.") end else outputChatBox("Not an element.") end end end ) function ckCloseWindow() destroyElement(ck_window) guiSetInputEnabled(false) showCursor(false) end Edited May 30, 2019 by myonlake Link to comment
Jaysds1 Posted April 10, 2012 Share Posted April 10, 2012 I think when a ped dies, their not an element anymore, because they're dead... plus gta automatically removes it from the game or the world so, MTA needs to remove it as an element. Link to comment
karlis Posted April 10, 2012 Share Posted April 10, 2012 that's clearly wrong, the ped remains died until it is respawned. Link to comment
Jaysds1 Posted April 10, 2012 Share Posted April 10, 2012 that's clearly wrong, the ped remains died until it is respawned. ya ya ya , Do you have a solution for this problem? Link to comment
karlis Posted April 10, 2012 Share Posted April 10, 2012 The ped is collisonless right? This might be the issue, that onClientClick needs collisons to detect an element. Not sure tho. Link to comment
Jaysds1 Posted April 10, 2012 Share Posted April 10, 2012 He can try attaching setElementData to the ped before he dies, like on resource start or player join... then get the element data here. Link to comment
myonlake Posted April 10, 2012 Author Share Posted April 10, 2012 Believe me, element datas are working well. I will take a look if I have disabled collisions. Link to comment
Maurize Posted April 10, 2012 Share Posted April 10, 2012 Simply create a ped with dead-animation on this place... it will sure work with client click and this stuff... try to find a way to work arround your problem(: Link to comment
Kenix Posted April 11, 2012 Share Posted April 11, 2012 Try use this https://wiki.multitheftauto.com/wiki/OnElementClicked Link to comment
Jaysds1 Posted April 11, 2012 Share Posted April 11, 2012 Try use this https://wiki.multitheftauto.com/wiki/OnElementClicked I've never seen that function in MTA before... and it was last modified in 2008 Link to comment
qaisjp Posted July 10, 2012 Share Posted July 10, 2012 Try use this https://wiki.multitheftauto.com/wiki/OnElementClicked I've never seen that function in MTA before... and it was last modified in 2008 thats because its not a function and you are blind. bump neccesary Link to comment
Jaysds1 Posted July 10, 2012 Share Posted July 10, 2012 Try use this https://wiki.multitheftauto.com/wiki/OnElementClicked I've never seen that function in MTA before... and it was last modified in 2008 thats because its not a function and you are blind. bump neccesary actually, bump is not necessary and I found out later it was an event 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