ChoTax Posted January 1, 2013 Share Posted January 1, 2013 hello guys ! i want get the text in edit for creat team but i don't know waht the problem pls help me this my script : server : addEvent ("exit" , true ) addEventHandler("exit", root, function () setPlayerTeam ( source, nil ) end ) addEvent ("creat" , true ) addEventHandler("creat", root, function () createTeam ( ""..cree, 0, 255 , 0 ) end ) client : GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} win = guiCreateWindow(239,124,275,334,"",false) guiSetVisible ( win , false ) cre = guiCreateButton(192,36,68,39,"Creat Group",false,win) GUIEditor_Edit[1] = guiCreateEdit(13,39,171,33,"",false,win) lea = guiCreateButton(206,84,54,87,"Leave Group",false,win) GUIEditor_Label[1] = guiCreateLabel(12,86,174,23,"You're Group : Noun",false,win) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) bindKey ( "X" , "down" , function() if ( guiGetVisible ( win ) == true ) then guiSetVisible ( win ,false ) showCursor (false ) elseif ( guiGetVisible ( win ) == false ) then guiSetVisible ( win ,true ) showCursor (true ) p = (getTeamName(getPlayerTeam(localPlayer))) guiSetText ( GUIEditor_Label[1], " You're Group : "..p) end end ) addEventHandler("onClientGUIClick", lea, function () if ( source == lea ) then if getPlayerTeam ( localPlayer ) then triggerServerEvent("exit", localPlayer) guiSetText ( GUIEditor_Label[1], " You're Group : noun ") outputChatBox ( "#FF0000* You're left the group !", 255, 0, 0, true ) else outputChatBox ( "#FF0000* You're not in group !", 255, 0, 0, true ) end end end ) addEventHandler("onClientGUIClick", root, function () local cree = guiGetText(GUIEditor_Edit[1]) if ( source == cre ) then triggerServerEvent("creat", localPlayer) end end ) Link to comment
Blaawee Posted January 1, 2013 Share Posted January 1, 2013 client: GUIEditor_Window = { } GUIEditor_Button = { } GUIEditor_Label = { } GUIEditor_Edit = { } GUIEditor_Window[1] = guiCreateWindow( 239, 124, 275, 334, "", false ) GUIEditor_Button[1] = guiCreateButton( 192, 36, 68, 39, "Creat Group", false, GUIEditor_Window[1] ) GUIEditor_Button[2] = guiCreateButton( 206, 84, 54, 87, "Leave Group", false, GUIEditor_Window[1] ) GUIEditor_Label[1] = guiCreateLabel( 12, 86, 174, 23, "You're Group : [ ".. getTeamName( getPlayerTeam( localPlayer ) ) .. " ]", false, GUIEditor_Window[1] ) GUIEditor_Edit[1] = guiCreateEdit( 13, 39, 171, 33, "", false, GUIEditor_Window[1] ) guiLabelSetColor( GUIEditor_Label[1], 255, 255, 255 ) guiLabelSetVerticalAlign( GUIEditor_Label[1], "top" ) guiLabelSetHorizontalAlign( GUIEditor_Label[1], "left", false ) guiSetVisible ( GUIEditor_Window[1] , false ) bindKey ( "X" , "down" , function( ) if guiGetVisible ( GUIEditor_Window[1] ) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) else guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end ) addEventHandler( "onClientGUIClick", guiRoot, function ( ) if source == GUIEditor_Button[1] then triggerServerEvent( "creat", localPlayer, guiGetText( GUIEditor_Edit[1] ) ) elseif source == GUIEditor_Button[2] then triggerServerEvent( "exit", localPlayer ) end end ) server addEvent ( "exit", true ) addEventHandler( "exit", root, function ( ) setPlayerTeam ( source, nil ) end ) addEvent ( "creat", true ) addEventHandler( "creat", root, function ( teamName ) createTeam ( teamName, 0, 255 , 0 ) setPlayerTeam ( source, teamName ) end ) Link to comment
Castillo Posted January 1, 2013 Share Posted January 1, 2013 In this line: triggerServerEvent("creat", localPlayer) You should trigger the edit box text like this: triggerServerEvent("creat", localPlayer, cree) And in server side you should add the 'cree' argument. addEvent ("creat" , true ) addEventHandler("creat", root, function ( cree ) createTeam ( ""..cree, 0, 255 , 0 ) end ) Link to comment
ChoTax Posted January 1, 2013 Author Share Posted January 1, 2013 In this line: triggerServerEvent("creat", localPlayer) You should trigger the edit box text like this: triggerServerEvent("creat", localPlayer, cree) And in server side you should add the 'cree' argument. addEvent ("creat" , true ) addEventHandler("creat", root, function ( cree ) createTeam ( ""..cree, 0, 255 , 0 ) end ) thank you for help Link to comment
ChoTax Posted January 1, 2013 Author Share Posted January 1, 2013 (edited) how can i delete the team on player click ? addEventHandler("onClientGUIClick", lea, function () if ( source == lea ) then if getPlayerTeam ( localPlayer ) then triggerServerEvent("exit", localPlayer) guiSetText ( GUIEditor_Label[1], " You're Group : noun ") outputChatBox ( "#FF0000* You're left the group !", 255, 0, 0, true ) else outputChatBox ( "#FF0000* You're not in group !", 255, 0, 0, true ) end end end ) how can i do it ? Edited January 1, 2013 by Guest Link to comment
Castillo Posted January 1, 2013 Share Posted January 1, 2013 You mean, you want to destroy the team he wrote in the edit box? if so: getTeamFromName destroyElement Link to comment
ChoTax Posted January 1, 2013 Author Share Posted January 1, 2013 You mean, you want to destroy the team he wrote in the edit box? if so: getTeamFromName destroyElement i mean , i want destroy team on player left team ! Link to comment
Castillo Posted January 1, 2013 Share Posted January 1, 2013 teams = { } addEvent ( "exit", true ) addEventHandler( "exit", root, function ( ) setPlayerTeam ( source, nil ) if ( isElement ( teams [ source ] ) ) then destroyElement ( teams [ source ] ) teams [ source ] = nil end end ) addEvent ( "creat", true ) addEventHandler( "creat", root, function ( cree ) local team = createTeam ( cree, 0, 255 , 0 ) teams [ source ] = team setPlayerTeam ( source, team ) end ) That? Link to comment
ChoTax Posted January 1, 2013 Author Share Posted January 1, 2013 teams = { } addEvent ( "exit", true ) addEventHandler( "exit", root, function ( ) setPlayerTeam ( source, nil ) if ( isElement ( teams [ source ] ) ) then destroyElement ( teams [ source ] ) teams [ source ] = nil end end ) addEvent ( "creat", true ) addEventHandler( "creat", root, function ( cree ) local team = createTeam ( cree, 0, 255 , 0 ) teams [ source ] = team setPlayerTeam ( source, team ) end ) That? yes , thaanx 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