Jump to content

table problem!


gokalpfirat

Recommended Posts

Posted

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.

Posted
----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

Posted
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 (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 by Guest4401
Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...