Juan_Camilo Posted June 22, 2020 Share Posted June 22, 2020 tengo una duda he creado este panel para cambiar de team es decir que yo le cambie el team a un jugador pero cuando le doy "CONTRATAR" me cambia el team a mi que hago? Client function empre() local screenW, screenH = guiGetScreenSize() contrataciones = guiCreateWindow((screenW - 628) / 2, (screenH - 430) / 2, 628, 430, "NOMBRE DE LA EMPRESA", false) guiSetProperty(contrataciones, "CaptionColour", "FF0036FE") jugador = guiCreateGridList(44, 43, 233, 338, false, contrataciones) guiGridListAddColumn(jugador, "Jugadores", 0.9) for _, player in ipairs(getElementsByType("player")) do guiGridListAddRow(jugador, getPlayerName(player)) end contrar = guiCreateButton(368, 107, 176, 43, "CONTRATAR", false, contrataciones) guiSetProperty(contrar, "NormalTextColour", "FF2FFD00") x = guiCreateButton(574, 33, 44, 42, "X", false, contrataciones) guiSetProperty(x, "NormalTextColour", "FFFC0000") despe = guiCreateButton(368, 251, 176, 43, "DESPEDIR", false, contrataciones) guiSetProperty(despe, "NormalTextColour", "FFFC0000") showCursor (true) end addEvent( "onEmpresa", true ) addEventHandler( "onEmpresa", localPlayer, empre ) addEventHandler('onClientGUIClick',root, function() if source == contrar then triggerServerEvent('setEmpresa',localPlayer) guiSetVisible(contrataciones,false) showCursor(false) end end) addEventHandler('onClientGUIClick',root, function() if source == despe then triggerServerEvent('setEmpresaNo',localPlayer) guiSetVisible(contrataciones,false) showCursor(false) end end) addEventHandler('onClientGUIClick',root, function() if source == x then guiSetVisible(contrataciones,false) showCursor(false) end end) Server empresa = createTeam("TEAM", 0, 255, 0) --team addEvent('setEmpresa',true) --contratar, addEventHandler('setEmpresa',root, function() local teamPlayer = getPlayerTeam ( source ) if teamPlayer then setPlayerTeam ( source, nil ) setPlayerTeam ( source, empresa ) else setPlayerTeam ( source, empresa ) end end) addEvent('setEmpresaNo',true) --despedir addEventHandler('setEmpresaNo',root, function() local playerTeam = getPlayerTeam( source ) if ( getTeamName( playerTeam ) == "TEAM" ) then --team setPlayerTeam ( source, nil ) end end) addCommandHandler ("empresa", --Comando, no confundir con teleport function ( playerSource ) account = getPlayerAccount(playerSource) accname = getAccountName(account) if( accname == "Juan_Camilo" ) then -- lo que esta dentro de las comillas es el nombre de la cuenta que tiene permitido usar el comando. triggerClientEvent ( playerSource, "onEmpresa", playerSource) end end ) Link to comment
FabianRs Posted June 22, 2020 Share Posted June 22, 2020 triggerServerEvent('setEmpresa',localPlayer) Ese es tu error, debes cambiar el localPlayer por el jugador al que deseas contratar Link to comment
FabianRs Posted June 22, 2020 Share Posted June 22, 2020 3 minutes ago, Juan_Camilo said: algun ejemplo? addEventHandler('onClientGUIClick',root, function() if source == contrar then local row = guiGridListGetSelectedItem(jugador) local text = guiGridListGetItemText(jugador,row,1) if ( row > -1 ) then triggerServerEvent('setEmpresa',getPlayerFromName(text)) guiSetVisible(contrataciones,false) showCursor(false) end end end) No lo probe, pero creeria que anda. 1 Link to comment
Juan_Camilo Posted June 22, 2020 Author Share Posted June 22, 2020 gracias si me sirvio 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