DexoTronic Posted March 28, 2010 Share Posted March 28, 2010 Hi, i have this code: function createPlayerList () Verkauffenster = guiCreateWindow(406,259,458,565,"",false) Label = guiCreateLabel(15,31,418,87,"FortCarson Autohaus",false,Verkauffenster ) guiLabelSetColor(Label ,255,120,0) guiLabelSetVerticalAlign(Label ,"top") guiLabelSetHorizontalAlign(Label ,"left",false) guiSetFont(Label ,"sa-header") VorschauBild = guiCreateStaticImage(239,126,173,170,"images/taxi.jpg",false,Verkauffenster ) KaufenBtn = guiCreateButton(18,510,431,46,"Kaufen",false,Verkauffenster ) SchliessenBtn = guiCreateButton(405,27,44,46,"X",false,Verkauffenster ) VorschauBtn = guiCreateButton(240,306,174,38,"Vorschau",false,Verkauffenster ) Liste = guiCreateGridList(14,125,214,379,false,Verkauffenster ) guiGridListSetSelectionMode(Liste,2) column = guiGridListAddColumn(Liste,"Fahrzeug",1.0) Fahrzeug1 = guiGridListAddRow(Liste) guiGridListSetItemText ( Liste, Fahrzeug1 , column, "Sabre", false, false ) Fahrzeug2 = guiGridListAddRow(Liste) guiGridListSetItemText ( Liste, Fahrzeug2 , column, "Sabre1", false, false ) Fahrzeug3 = guiGridListAddRow(Liste) guiGridListSetItemText ( Liste, Fahrzeug3 , column, "Sabre2", false, false ) Fahrzeug4 = guiGridListAddRow(Liste) guiGridListSetItemText ( Liste, Fahrzeug4 , column, "Sabre3", false, false ) Fahrzeug5 = guiGridListAddRow(Liste) guiGridListSetItemText ( Liste, Fahrzeug5 , column, "Sabre4", false, false ) Fahrzeug6 = guiGridListAddRow(Liste) guiGridListSetItemText ( Liste, Fahrzeug6 , column, "Sabre5", false, false ) addEventHandler ( "onClientGUIClick", playerList, click ) end addEventHandler ( "onClientResourceStart", getRootElement(), createPlayerList ) function click () local item = guiGridListGetItemText ( Liste , guiGridListGetSelectedItem ( Liste ), 1 ) outputChatBox ( item ) end but if i click one of the items, it doenst send a text message whats wrong where? Link to comment
50p Posted March 28, 2010 Share Posted March 28, 2010 You better stop copy'n'pasting code from one resource to yours... These errors are deadly simple but scripts look more complicated than these errors. I suggest you learn some Lua from other resources. Also, if you want to copy and paste the code from other resources, I'd recommend you rewrite the code instead of copying it since you learn more from typing code up than from copying it. You should also get error/warning message when you start this script (use "/debugscript 3" command to see error/warning messages for client-side scripts as well as for server-side scripts) since you don't have playerList defined anywhere in the code but you try to attach event handler to it. Change playerList (line 28) to Liste and add ",false " after click (the same line). Link to comment
DexoTronic Posted March 28, 2010 Author Share Posted March 28, 2010 thanks, worked. you have icq or msn? Link to comment
robhol Posted March 28, 2010 Share Posted March 28, 2010 What did I tell you earlier about coding in German? 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