gokalpfirat Posted February 6, 2013 Posted February 6, 2013 server.lua Tags = { {"%[HW%]", "Holy Warriors", "#50B200", nil} } addEvent ( "addClan", true ) addEventHandler ( "addClan", root, function ( tag,name,color ) table.insert(Tags,{tag,name,color,nil}) end ) client.lua myWindow = guiCreateWindow ( 0.3, 0.3, 0.4, 0.6, "Clan Ekle", true ) guiCreateLabel(0.1,0.2,0.4,0.6,"Tag",true,myWindow) editBox = guiCreateEdit( 0.3, 0.2, 0.4, 0.05, "", true,myWindow ) guiCreateLabel(0.1,0.4,0.4,0.6,"Clan Adı",true,myWindow) editBox1 = guiCreateEdit( 0.3, 0.4, 0.4, 0.05, "", true,myWindow ) guiCreateLabel(0.1,0.6,0.4,0.6,"Renk Kodu",true,myWindow) editBox2 = guiCreateEdit( 0.3, 0.6, 0.4, 0.05, "", true,myWindow ) button = guiCreateButton( 0.35, 0.8, 0.2, 0.1, "Ekle", true,myWindow ) showCursor(true) function outputEditBox () local tag = guiGetText ( editBox ) local name = guiGetText ( editBox1 ) local color = guiGetText ( editBox2 ) triggerServerEvent ( "addClan", getLocalPlayer(), tag,name,color ) end addEventHandler ( "onClientGUIClick", button, outputEditBox ) It wont adds to table.
Max+ Posted February 6, 2013 Posted February 6, 2013 ----clientSide myWindow = guiCreateWindow ( 0.3, 0.3, 0.4, 0.6, "Clan Ekle", true ) guiCreateLabel(0.1,0.2,0.4,0.6,"Tag",true,myWindow) editBox = guiCreateEdit( 0.3, 0.2, 0.4, 0.05, "", true,myWindow ) guiCreateLabel(0.1,0.4,0.4,0.6,"Clan Adı",true,myWindow) editBox1 = guiCreateEdit( 0.3, 0.4, 0.4, 0.05, "", true,myWindow ) guiCreateLabel(0.1,0.6,0.4,0.6,"Renk Kodu",true,myWindow) editBox2 = guiCreateEdit( 0.3, 0.6, 0.4, 0.05, "", true,myWindow ) button = guiCreateButton( 0.35, 0.8, 0.2, 0.1, "Ekle", true,myWindow ) showCursor(true) function outputEditBox () local tag = guiGetText ( editBox ) local name = guiGetText ( editBox1 ) local color = guiGetText ( editBox2 ) triggerServerEvent ( "addClan", localPlayer, tag,name,color ) end addEventHandler ( "onClientGUIClick", button, outputEditBox ) ----ServerSide addEvent('addClan', true) addEventHandler('addClan', root, function ( tag,name,color ) Tags = { {"%[HW%]", "Holy Warriors", "#50B200", nil} } table.insert(Tags,{tag,name,color,nil}) end ) and use /debugscript 3 and tell us what is the errors shown
Renkon Posted February 6, 2013 Posted February 6, 2013 What about using table[#table + 1] = {tag, name, color, nil} Rather than table.insert(Tags,{tag,name,color,nil})
gokalpfirat Posted February 6, 2013 Author Posted February 6, 2013 What about using table[#table + 1] = {tag, name, color, nil} Rather than table.insert(Tags,{tag,name,color,nil}) Wont work.
gokalpfirat Posted February 6, 2013 Author Posted February 6, 2013 this is rest of the code you see anything that arent writing?
Renkon Posted February 6, 2013 Posted February 6, 2013 What about using table[#table + 1] = {tag, name, color, nil} Rather than table.insert(Tags,{tag,name,color,nil}) Wont work. Have you at least renamed table to Tags
Guest Guest4401 Posted February 6, 2013 Posted February 6, 2013 (edited) _ What about using table[#table + 1] = {tag, name, color, nil} Rather than table.insert(Tags,{tag,name,color,nil}) They both do the same. @gokalfpirat The script seems to be fine, it's just that not tested it properly. If you check it like Tags[2] and you find a table there, then your script works absolutely fine. And by the way, your method is quite inconvenient, because after you restart the resource the teams added with table.insert won't be there in the table anymore. Edited February 6, 2013 by Guest4401
TAPL Posted February 6, 2013 Posted February 6, 2013 this is rest of the code you see anything that arent writing? Yes, i don't see where you have use the table or doing anything with it.
gokalpfirat Posted February 6, 2013 Author Posted February 6, 2013 Yes I dont do because first I want to learn how to use table.insert with this code
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