Wei Posted April 28, 2012 Share Posted April 28, 2012 What's the problem? No debug errors! function clientClickGuiDoThat ( ) if ( source == blipbutplayer ) then row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerblip = createBlipAttactedTo( localPlayer ) else destroyElement(playerblip) end end end addEventHandler("onClientGuiClick", root, clientClickGuiDoThat) Link to comment
Kenix Posted April 28, 2012 Share Posted April 28, 2012 function 'createBlipAttactedTo' not exists Also, why you make variable 'playerblip' local? P.S Tabulate your code please! Link to comment
arezu Posted April 28, 2012 Share Posted April 28, 2012 no debug error? lies, it should say: attempt to call nil value 'createBlipAttactedTo'. it should be createBlipAttachedTo Link to comment
Wei Posted April 28, 2012 Author Share Posted April 28, 2012 function 'createBlipAttactedTo' not exists Also, why you make variable 'playerblip' local? P.S Tabulate your code please! How to tabulate code ? Link to comment
yMassai Posted April 28, 2012 Share Posted April 28, 2012 Maybe function clientClickGuiDoThat ( ) if ( source == blipbutplayer ) then row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerblip = createBlipAttachedTo( localPlayer ) else destroyElement(playerblip) end end end addEventHandler("onClientGuiClick", root, clientClickGuiDoThat) Link to comment
Guest Guest4401 Posted April 28, 2012 Share Posted April 28, 2012 Did you know that events are case sensitive? Change onClientGuiClick to onClientGUIClick Link to comment
Kenix Posted April 28, 2012 Share Posted April 28, 2012 function 'createBlipAttactedTo' not exists Also, why you make variable 'playerblip' local? P.S Tabulate your code please! How to tabulate code ? http://en.wikipedia.org/wiki/Programming_style Link to comment
Wei Posted April 28, 2012 Author Share Posted April 28, 2012 now it works. if ( source == blipbutplayer ) then select = guiGridListGetSelectedItem ( playerlistgrid ) if select then playerblip = createBlipAttachedTo( localPlayer, 58 ) else destroyElement(playerblip) end end end addEventHandler("onClientGUIClick", root, clientClickGuiDoThat) but idk how to destoy it Link to comment
yMassai Posted April 28, 2012 Share Posted April 28, 2012 you want it destroyed the "blip" when the player quit the game? Link to comment
Wei Posted April 28, 2012 Author Share Posted April 28, 2012 no when player clicks 1 more time on button. Link to comment
Kenix Posted April 28, 2012 Share Posted April 28, 2012 (edited) now it works. if ( source == blipbutplayer ) then select = guiGridListGetSelectedItem ( playerlistgrid ) if select then playerblip = createBlipAttachedTo( localPlayer, 58 ) else destroyElement(playerblip) end end end addEventHandler("onClientGUIClick", root, clientClickGuiDoThat) but idk how to destoy it OFFTOPIC: Again you not tabulate code I gave you link. Why you not read? but idk how to destoy it destroyElement Edited April 28, 2012 by Guest Link to comment
Wei Posted April 28, 2012 Author Share Posted April 28, 2012 now it works. if ( source == blipbutplayer ) then select = guiGridListGetSelectedItem ( playerlistgrid ) if select then playerblip = createBlipAttachedTo( localPlayer, 58 ) else destroyElement(playerblip) end end end addEventHandler("onClientGUIClick", root, clientClickGuiDoThat) but idk how to destoy it OFFTOPIC: Again you not tabulate code I gave you link. Why you not read? function clientClickGuiDoThat ( ) if ( source == blipbutplayer ) then select = guiGridListGetSelectedItem ( playerlistgrid ) if select then return true playerblip = createBlipAttachedTo( localPlayer, 58 ) else return false destroyElement(playerblip) end end end addEventHandler("onClientGUIClick", root, clientClickGuiDoThat) ? Link to comment
Kenix Posted April 28, 2012 Share Posted April 28, 2012 P.S I need make TUT about tabulation, i guess. Link to comment
Wei Posted April 28, 2012 Author Share Posted April 28, 2012 P.S I need make TUT about tabulation, i guess. how can I tabulate Link to comment
Absence2 Posted April 28, 2012 Share Posted April 28, 2012 P.S I need make TUT about tabulation, i guess. how can I tabulate viewtopic.php?f=148&t=41066 Link to comment
Wei Posted April 28, 2012 Author Share Posted April 28, 2012 so thats commenting or what ? Link to comment
Absence2 Posted April 28, 2012 Share Posted April 28, 2012 read the post TAB(ulate) button Recommended coding designWhen you are coding, it is recommend to indent (by using TAB or four spaces) lines as per the scope, see the example below. local scope1 = math.random(3) local debug = 1 if scope1 == 1 then-- new scope if debug == 1 then outputDebugString("Testing feature 'balls'") if balls then outputDebugString('Balls were ripped') else outputDebugString('Balls survived') end end end Link to comment
Wei Posted April 28, 2012 Author Share Posted April 28, 2012 if ( source == blipbutplayer ) then select = guiGridListGetSelectedItem ( playerlistgrid ) if select then playerblip = createBlipAttachedTo( localPlayer, 58 ) else destroyElement(playerblip) end end end addEventHandler("onClientGUIClick", root, clientClickGuiDoThat) @Kenix Thats better ? 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