Wei Posted April 28, 2012 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)
Kenix Posted April 28, 2012 Posted April 28, 2012 function 'createBlipAttactedTo' not exists Also, why you make variable 'playerblip' local? P.S Tabulate your code please!
arezu Posted April 28, 2012 Posted April 28, 2012 no debug error? lies, it should say: attempt to call nil value 'createBlipAttactedTo'. it should be createBlipAttachedTo
Wei Posted April 28, 2012 Author 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 ?
yMassai Posted April 28, 2012 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)
Guest Guest4401 Posted April 28, 2012 Posted April 28, 2012 Did you know that events are case sensitive? Change onClientGuiClick to onClientGUIClick
Kenix Posted April 28, 2012 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
Wei Posted April 28, 2012 Author 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
yMassai Posted April 28, 2012 Posted April 28, 2012 you want it destroyed the "blip" when the player quit the game?
Kenix Posted April 28, 2012 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
Wei Posted April 28, 2012 Author 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) ?
Wei Posted April 28, 2012 Author Posted April 28, 2012 P.S I need make TUT about tabulation, i guess. how can I tabulate
Absence2 Posted April 28, 2012 Posted April 28, 2012 P.S I need make TUT about tabulation, i guess. how can I tabulate viewtopic.php?f=148&t=41066
Absence2 Posted April 28, 2012 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
Wei Posted April 28, 2012 Author 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 ?
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