AlvareZ_ Posted January 23, 2013 Share Posted January 23, 2013 Que funciones deberia usar para crear mi propio spawn panel algo simple ? pero usare esto para crearlos guiGridListAddRow Link to comment
Xperia Posted January 24, 2013 Share Posted January 24, 2013 Client: --Para escoger grupos y skins y armas o lo que quieras guiGridListGetSelectedItem guiGridListGetItemText --ID's, ammo, etc. triggerServerEvent --Poner la camara al player cuando spawnee setCameraTarget fadeCamera Server: createTeam getTeamFromName setPlayerTeam PD: No se si las puse todas pero si tienes dudas o algo me avisas, porque hace poco hice mi propio spawn. Link to comment
AlvareZ_ Posted January 24, 2013 Author Share Posted January 24, 2013 Mira esto es un ejemplo, seria algo haci? pero no me anda GUIEditor = { gridlist = {}, } GUIEditor.gridlist[1] = guiCreateGridList(175, 168, 167, 158, false) guiGridListAddColumn(GUIEditor.gridlist[1], "Categoria", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Los Santos", false, false) GUIEditor.gridlist[2] = guiCreateGridList(182, 342, 165, 148, false) guiGridListSetSelectionMode(GUIEditor.gridlist[2],2) grupos = guiGridListAddColumn(GUIEditor.gridlist[2], " ", 0.9) guiSetVisible ( ventana , true ) showCursor ( true ) function spawnLS ( ) if ( GUIEditor.gridlist[1] ) then local row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local cityName = guiGridListGetItemText ( source, row, 1 ) if ( cityName == "Los Santos" ) then guiGridListClear ( GUIEditor.gridlist[2] ) rowGrupoPolice = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice, grupos, "Police", false, false ) end end end end addEventHandler ( "onClientGUIClick", GUIEditor.gridlist[2], spawnLS, false ) Link to comment
AlvareZ_ Posted January 25, 2013 Author Share Posted January 25, 2013 ya quite esa parte la corregi pero sigue sin salirme cuando le doy a Los Santos no me sale nada Link to comment
Xperia Posted January 25, 2013 Share Posted January 25, 2013 Porque no usaste: spawnPlayer PD: Y si no me equivoco, lo copiaste de mi reciente post. Link to comment
AlvareZ_ Posted January 25, 2013 Author Share Posted January 25, 2013 Ya logre solucionarlo, si es tu tu post ya q era lo mismo si te molesta podria hacer otra cosa Link to comment
Xperia Posted January 25, 2013 Share Posted January 25, 2013 No claro que no me molesta, si esta ahi es para compartirlo con los demas. Link to comment
AlvareZ_ Posted January 25, 2013 Author Share Posted January 25, 2013 Muchas gracias me tope con otro error : function name1 ( ) if ( rowCitySF ) then local row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local cityName = guiGridListGetItemText ( source, row, 1 ) if ( cityName == "Los Santos" ) then guiGridListClear ( grid_groups ) rowGroupsPolice = guiGridListAddRow ( grid_groups ) guiGridListSetItemText ( grid_groups, rowGroupsPolice, columnGroups, "Police", false, false ) end end end end addEventHandler ( "onClientGUIClick", grid_city, name1, false ) function name2 ( ) if ( rowCitySF ) then local row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -2 and col ~= -2 ) then local cityName = guiGridListGetItemText ( source, row, 2 ) if ( cityName == "Los Santos" ) then guiGridListClear ( grid_groups ) rowGroupsSheriff = guiGridListAddRow ( grid_groups ) guiGridListSetItemText ( grid_groups, rowGroupsSheriff, columnGroups, "Sheriff", false, false ) end end end end addEventHandler ( "onClientGUIClick", grid_city, name2, false ) solo me esta monstrando police ps camibe esto row and col and row ~= -2 and col ~= -2 y local cityName = guiGridListGetItemText ( source, row, 2 ) me faltaria algo para q ande solo me esta monstrando police Link to comment
Xperia Posted January 25, 2013 Share Posted January 25, 2013 Dime lo que te sale en el debug. Link to comment
AlvareZ_ Posted January 25, 2013 Author Share Posted January 25, 2013 solo me sale server triggeted clientside event onClientCall, bug but event its not added clientside mas nada Edit: Ya lo arregle gracias mas errores los ire poniendo me has ayudado mucho Link to comment
AlvareZ_ Posted January 25, 2013 Author Share Posted January 25, 2013 Listo tengo el clientside completo me tocaria con el serverside me podrias dar un ejemplo de como lo creastes tu claro si puede, si no me quedaria sacarlo Link to comment
Xperia Posted January 26, 2013 Share Posted January 26, 2013 Usa: createTeam addEvent addEventHandler getTeamFromName setPlayerTeam Link to comment
AlvareZ_ Posted January 26, 2013 Author Share Posted January 26, 2013 estube intentando.. serverside: teamMedico = createTeam ( "Medic", 255, 0, 0 ) function spawnMedic ( source, weapon, ammo) local teamName = guiGridListSetItemText ( source, row, 1 ) if ( teamName == "Police 1" ) then setPlayerTeam ( source, teamMedico ) local x,y,z x = 414 y = 2536 z = 19 spawnPlayer ( source, x,y,z ) fadeCamera(source, true) takeAllWeapons ( source ) setElementHealth ( source, 100 ) setPlayerNametagColor ( source, 255,222,173 ) setPlayerSkin ( source, randInt(18, 26) ) setPlayerArmor ( source, 0 ) end addEvent("onPlayerChooseSkin", true) addEventHandler("onPlayerChooseSkin", getRootElement(), spawnMedic) Link to comment
Xperia Posted January 26, 2013 Share Posted January 26, 2013 Triggea eso al client: addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) setPlayerTeam ( source , team ) end ) Link to comment
AlvareZ_ Posted January 26, 2013 Author Share Posted January 26, 2013 client: --Select Team y Spawn addEventHandler ( "onClientGUIClick", root, function ( button ) if button == "left" then if source == spawn_button then local row, col = guiGridListGetSelectedItem ( grid_groups ) local teamName = guiGridListGetItemText ( grid_groups, row, col ) triggerServerEvent ( "onPlayerChooseTeam", getLocalPlayer(), teamName ) end end end ) --Select Skin y Spawn addEventHandler ( "onClientGUIClick", root, function ( button ) if button == "left" then if source == spawn_button then local row, col = guiGridListGetSelectedItem ( grid_skins ) local skinName = guiGridListGetItemText ( grid_skins, row, col ) triggerServerEvent ( "onPlayerChooseSkin", getLocalPlayer(), skinName ) end end end ) function test(player) guiSetVisible ( ventana , false ) guiSetVisible ( spawn_button , false ) guiSetVisible ( info , false ) showCursor ( false ) end addEventHandler("onClientPlayerSpawn",localPlayer,test) function test2(localPlayer) guiSetVisible ( ventana , true ) guiSetVisible ( spawn_button , true ) guiSetVisible ( info , true ) showCursor ( true ) end addEventHandler("onClientPlayerWasted",localPlayer,test2) addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) setPlayerTeam ( source , team ) end ) server: function createteam () teamMedico = createTeam ( "Mexicans", 255, 0, 0 ) end addEventHandler("onResourceStart, getElementRoot(), createteam) function spawnMexi ( source, weapon, ammo) local teamName = guiGridListSetItemText ( source, row, 1 ) if ( teamName == "Mexicans 1" ) then setPlayerTeam ( source, teamMedico ) local x,y,z x = 414 y = 2536 z = 19 spawnPlayer ( source, x,y,z ) fadeCamera(source, true) takeAllWeapons ( source ) setElementHealth ( source, 100 ) setPlayerNametagColor ( source, 255,222,173 ) setPlayerSkin ( source, randInt(18, 26) ) setPlayerArmor ( source, 0 ) triggerClientEvent ( "onPlayerChooseTeam", getRootElement(), teamName ) end addEvent("onPlayerChooseTeam", true) addEventHandler("onPlayerChooseTeam", getRootElement(), spawnMexi) osea use lo mismo q en tu spawn algo anda mal? no se q pasa Link to comment
FraN-724 Posted January 26, 2013 Share Posted January 26, 2013 function createteam () teamMedico = createTeam ( "Mexicans", 255, 0, 0 ) end addEventHandler("onResourceStart", getElementRoot(), createteam) function spawnMexi ( source, weapon, ammo) local teamName = guiGridListSetItemText ( source, row, 1 ) if ( teamName == "Mexicans 1" ) then setPlayerTeam ( source, teamMedico ) local x,y,z x = 414 y = 2536 z = 19 spawnPlayer ( source, x,y,z ) fadeCamera(source, true) takeAllWeapons ( source ) setElementHealth ( source, 100 ) setPlayerNametagColor ( source, 255,222,173 ) setPlayerSkin ( source, randInt(18, 26) ) setPlayerArmor ( source, 0 ) triggerClientEvent ( "onPlayerChooseTeam", getRootElement(), teamName ) end end addEvent("onPlayerChooseTeam", true) addEventHandler("onPlayerChooseTeam", getRootElement(), spawnMexi) Tenias unos errores en server Link to comment
AlvareZ_ Posted January 26, 2013 Author Share Posted January 26, 2013 Sigue sin spawnear cuando elijo el skin Mexicans 1 Link to comment
FraN-724 Posted January 26, 2013 Share Posted January 26, 2013 Prueba Así function createteam () teamMedico = createTeam ( "Mexicans", 255, 0, 0 ) end addEventHandler("onResourceStart", getRootElement(), createteam) function spawnMexi ( source, weapon, ammo) local teamName = guiGridListSetItemText ( source, row, 1 ) if ( teamName == "Mexicans 1" ) then setPlayerTeam ( source, teamMedico ) local x,y,z x = 414 y = 2536 z = 19 spawnPlayer ( source, x,y,z ) fadeCamera(source, true) takeAllWeapons ( source ) setElementHealth ( source, 100 ) setPlayerNametagColor ( source, 255,222,173 ) setPlayerSkin ( source, randInt(18, 26) ) setPlayerArmor ( source, 0 ) triggerClientEvent ( "onPlayerChooseTeam", getRootElement(), teamName ) end end addEvent("onPlayerChooseTeam", true) addEventHandler("onPlayerChooseTeam", getRootElement(), spawnMexi) Link to comment
AlvareZ_ Posted January 26, 2013 Author Share Posted January 26, 2013 me crea el team pero no spawnea selecciono Los Santos > Mexicans > Mexicans 1 y no me spawnea ni me mueve al team Link to comment
AlvareZ_ Posted January 26, 2013 Author Share Posted January 26, 2013 en el debug me dice client triggered serverside event onPlayerChooseSkin, but event not added serverside attempt to call global 'guiGridListSetItemTex' ( a nil value ) Link to comment
Castillo Posted January 27, 2013 Share Posted January 27, 2013 Porque mezclaste client side y server side, las funciones de GUI son todas client side. Postea tu script completo ( ambas partes: client y server side ). Link to comment
Recommended Posts