hemen Posted August 17, 2010 Share Posted August 17, 2010 I cannot get the variable in client-side script, who (the variable) is returned by server-side function. --Client-side triggerServerEvent ( "createTeam1", getRootElement(), text,GangInfo.RColor[AllGangs],GangInfo.GColor[AllGangs],GangInfo.BColor[AllGangs],GangInfo.TeamID[AllGangs]) --Server-side function createTeam1 ( name,r,g,b,var1 ) local var1 = createTeam(name,r,g,b) end addEvent( "createTeam1", true ) addEventHandler( "createTeam1", getRootElement(), createTeam1 ) Edit by varez: Changed code tags to lua tags. Use them next time And comment lines in lua start with -- (double dash) not // (double slash) Link to comment
dzek (varez) Posted August 17, 2010 Share Posted August 17, 2010 I cannot get the variable in client-side script, who (the variable) is returned by server-side function. umm, your script suggest you want to get variable in server side from client-side o_O any errors? outputDebugString(GangInfo.RColor[AllGangs].."--"..GangInfo.GColor[AllGangs].."--"..GangInfo.BColor[AllGangs].."--"..GangInfo.TeamID[AllGangs]) triggerServerEvent ("createTeam1", getRootElement(), text, GangInfo.RColor[AllGangs],GangInfo.GColor[AllGangs],GangInfo.BColor[AllGangs],GangInfo.TeamID[AllGangs]) function createTeam1 ( name,r,g,b,var1 ) outputDebugString("srv: "..name.."--"..r.."--"..g.."--"..b) local var1 = createTeam(name,r,g,b) end addEvent( "createTeam1", true ) addEventHandler( "createTeam1", getRootElement(), createTeam1 ) now ingame enter in console "debugscript 3" and see what it outputs.. Link to comment
hemen Posted August 17, 2010 Author Share Posted August 17, 2010 [2010-08-17 21:52:31] ERROR: [string "gang\gang_client.lua"]:309: attempt to concatenate field '?' (a nil value) outputChatBox(""..GangInfo.RColor[AllGangs].."")--308 outputChatBox(""..GangInfo.TeamID[AllGangs].."")--309 Edit by varez: Changed code tags to lua tags. Link to comment
dzek (varez) Posted August 17, 2010 Share Posted August 17, 2010 this says all, your GangInfo.TeamID[AllGangs] is nil == not set. Need more script to tell you more.. Or maybe you know now whats wrong? and -- WHY? outputChatBox(""..GangInfo.TeamID[AllGangs].."") -- WHEN YOU CAN JUST DO outputChatBox(GangInfo.TeamID[AllGangs]) And once again Use [lua][/lua] tags instead of [code][/code] Link to comment
hemen Posted August 17, 2010 Author Share Posted August 17, 2010 Ok. I didn't fixed my trouble, i simply delete code with Team. It's not very important function But i found new trouble - function doesn't work. --client-side triggerServerEvent("outputChatBox1","Join the gang - /gangjoin",player,0,175,0) --server-side function outputChatBox1Func (text,player,r,g,b) outputChatBox(text,player,r,g,b) end addEvent( "outputChatBox1", true ) addEventHandler( "outputChatBox1", getRootElement(), outputChatBox1Func ) And other function with player works. Link to comment
dzek (varez) Posted August 17, 2010 Share Posted August 17, 2010 click on this: triggerServerEvent read about 2nd argument. Link to comment
hemen Posted August 17, 2010 Author Share Posted August 17, 2010 click on this: triggerServerEvent read about 2nd argument. Ok, thank you. Topic can be closed. Link to comment
Recommended Posts