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) Diet with russian vodka, lose 3 days in one week !
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! http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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 ? Diet with russian vodka, lose 3 days in one week !
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) Community Profile MTA:SA = Click Here
Guest Guest4401 Posted April 28, 2012 Posted April 28, 2012 Did you know that events are case sensitive? Change onClientGuiClick to onClientGUIClick
yMassai Posted April 28, 2012 Posted April 28, 2012 Thanks for the info! Community Profile MTA:SA = Click Here
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 http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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 Diet with russian vodka, lose 3 days in one week !
yMassai Posted April 28, 2012 Posted April 28, 2012 you want it destroyed the "blip" when the player quit the game? Community Profile MTA:SA = Click Here
Wei Posted April 28, 2012 Author Posted April 28, 2012 no when player clicks 1 more time on button. Diet with russian vodka, lose 3 days in one week !
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 http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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) ? Diet with russian vodka, lose 3 days in one week !
Kenix Posted April 28, 2012 Posted April 28, 2012 P.S I need make TUT about tabulation, i guess. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Wei Posted April 28, 2012 Author Posted April 28, 2012 P.S I need make TUT about tabulation, i guess. how can I tabulate Diet with russian vodka, lose 3 days in one week !
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
Wei Posted April 28, 2012 Author Posted April 28, 2012 so thats commenting or what ? Diet with russian vodka, lose 3 days in one week !
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 ? Diet with russian vodka, lose 3 days in one week !
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