iFoReX Posted December 22, 2012 Share Posted December 22, 2012 La GUI No Me Aparece :// client : GUIEditor = { gridlist = {}, button = {}, label = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(209, 156, 453, 239, "Panel Autos Privados", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF00FBFF") GUIEditor.gridlist[1] = guiCreateGridList(9, 25, 197, 205, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Tus Autos", 0.9) GUIEditor.button[1] = guiCreateButton(211, 97, 232, 48, "spawn", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FBFF") GUIEditor.button[2] = guiCreateButton(210, 152, 233, 49, "respawn", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF00FBFF") GUIEditor.label[1] = guiCreateLabel(211, 24, 227, 58, "GUI Creada Por ElMota", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 253, 1, 1) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[1], "center") guiSetVisible(GUIEditor.window[1],false) addEvent("aparecer",true) addEventHandler("aparecer",root,function() guiSetVisible(GUIEditor.window[1],guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end ) server : addCommandHandler("autos",function(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent("aparecer",thePlayer) end end ) Link to comment
Castillo Posted December 22, 2012 Share Posted December 22, 2012 Cambia: triggerClientEvent("aparecer",thePlayer) Por: triggerClientEvent ( thePlayer, "aparecer", thePlayer ) Y fijate si funciona. Link to comment
iFoReX Posted December 22, 2012 Author Share Posted December 22, 2012 Gracias Solid, funciona, tenia un error tambien en el guiGetVisible Link to comment
iFoReX Posted December 22, 2012 Author Share Posted December 22, 2012 Ahora Me Da Error En GetAccount y GetAccountName ( la verdad nose como ocupar estas 2 funciones ) addCommandHandler("autos",function(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent ( thePlayer, "aparecer", thePlayer ) end end ) addEventHandler("onResourceStart",resourceRoot,function() for v,i in ipairs(getElementsByType"player") do local account = getAccount(i) local cuenta = getAccountName(i) if cuenta == "ElMota" then triggerClientEvent(thePlayer,"elmotacars",thePlayer) end end end ) Link to comment
Castillo Posted December 22, 2012 Share Posted December 22, 2012 En ves de getAccount, usa getPlayerAccount, y en getAccountName cambia "i" por "account". Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 ahora me dice ke el evento "elmota" no esta añadido al clientside addCommandHandler("autos",function(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent ( thePlayer, "aparecer", thePlayer ) end end ) addEventHandler("onResourceStart",resourceRoot,function() for v,i in ipairs(getElementsByType"player") do local account = getPlayerAccount(i) local cuenta = getAccountName(account) if cuenta == "ElMota" then triggerClientEvent("elmota",cuenta) end end end ) GUIEditor = { gridlist = {}, button = {}, label = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(209, 156, 453, 239, "Panel Autos Privados", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF00FBFF") GUIEditor.gridlist[1] = guiCreateGridList(9, 25, 197, 205, false, GUIEditor.window[1]) col = guiGridListAddColumn(GUIEditor.gridlist[1], "Tus Autos", 0.9) GUIEditor.button[1] = guiCreateButton(211, 97, 232, 48, "spawn", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FBFF") GUIEditor.button[2] = guiCreateButton(210, 152, 233, 49, "respawn", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF00FBFF") GUIEditor.label[1] = guiCreateLabel(211, 24, 227, 58, "GUI Creada Por ElMota Para PGS Server", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 253, 1, 1) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[1], "center") guiSetVisible(GUIEditor.window[1],false) -----autos-MOTA---- mota = createVehicle(411,-685.12195, 955.14368, 12.13281) addVehicleUpgrade ( mota, 1010 ) setVehicleDamageProof ( mota, true ) setVehicleColor ( mota, 0, 0, 0, 255, 0, 102 ) setElementData(mota, "owner", "ElMota") setElementData(mota, "model", "Carrito") ------------------- function onLockedVehicleEnter ( player, seat, jacked ) if getElementData(source, "owner") and getElementData(source, "owner" ) ~= getAccountName(getPlayerAccount(player)) and ( seat == 0 ) then outputChatBox ("*** [sERVER] Carro Propiedad De "..tostring(getElementData(source, "owner" )), player, 255, 255, 0) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), onLockedVehicleEnter ) addEvent("aparecer",true) addEventHandler("aparecer",root,function() guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end ) addEvent("elmota",true) addEventHandler("elmota",root,function() row1 = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1],row1,col,getElementData(mota,"model"),false,false) end ) Link to comment
Castillo Posted December 24, 2012 Share Posted December 24, 2012 Eso es porque el cliente aun no cargo el script. Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 como arreglo eso Link to comment
Castillo Posted December 24, 2012 Share Posted December 24, 2012 Vas a tener que hacer un trigger desde el cliente al iniciar el recurso ( onClientResourceStart ), luego en el server side verificas la cuenta y envias tu evento. Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 listo, ahora me da error y me dice : bad argument : triggerClientEvent ( expected at argument 2 ) got string 'ElMota' Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 addCommandHandler("autos",function(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent ( thePlayer, "aparecer", thePlayer ) end end ) addEvent("iniciar",true) addEventHandler("iniciar",root,function(thePlayer) for v,i in ipairs(getElementsByType"player") do local account = getPlayerAccount(i) local cuenta = getAccountName(account) if cuenta == "ElMota" then triggerClientEvent("elmota",cuenta) end end end ) Link to comment
Castillo Posted December 24, 2012 Share Posted December 24, 2012 addEvent ( "iniciar", true ) addEventHandler ( "iniciar", root, function ( ) local account = getPlayerAccount ( source ) local cuenta = getAccountName ( account ) if ( cuenta == "ElMota" ) then triggerClientEvent ( source, "elmota", source, cuenta ) end end ) Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 Funciona Solid, Gracias , ahora una duda, como hago para que si el player clickea el item "carrito" , aparesca el auto ? ( lo de que aparesca el auto ya lo se hacer ) Link to comment
Castillo Posted December 24, 2012 Share Posted December 24, 2012 guiGridListGetSelectedItem guiGridListGetItemText Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 Uso El Evento OnClientGUIClick ? Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 GUIEditor = { gridlist = {}, button = {}, label = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(209, 156, 453, 239, "Panel Autos Privados", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF00FBFF") GUIEditor.gridlist[1] = guiCreateGridList(9, 25, 197, 205, false, GUIEditor.window[1]) col = guiGridListAddColumn(GUIEditor.gridlist[1], "Tus Autos", 0.9) GUIEditor.button[1] = guiCreateButton(211, 97, 232, 48, "spawn", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FBFF") GUIEditor.button[2] = guiCreateButton(210, 152, 233, 49, "respawn", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF00FBFF") GUIEditor.label[1] = guiCreateLabel(211, 24, 227, 58, "GUI Creada Por ElMota Para PGS Server", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 253, 1, 1) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[1], "center") guiSetVisible(GUIEditor.window[1],false) -----autos-MOTA---- mota = createVehicle(411,-685.12195, 955.14368, 12.13281) addVehicleUpgrade ( mota, 1010 ) setVehicleDamageProof ( mota, true ) setVehicleColor ( mota, 0, 0, 0, 255, 0, 102 ) setElementData(mota, "owner", "ElMota") setElementData(mota, "model", "Carrito") ------------------- function onLockedVehicleEnter ( player, seat, jacked ) if getElementData(source, "owner") and getElementData(source, "owner" ) ~= getAccountName(getPlayerAccount(player)) and ( seat == 0 ) then outputChatBox ("*** [sERVER] Carro Propiedad De "..tostring(getElementData(source, "owner" )), player, 255, 255, 0) cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), onLockedVehicleEnter ) addEvent("aparecer",true) addEventHandler("aparecer",root,function() guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end ) addEventHandler("onClientResourceStart",resourceRoot,function() triggerServerEvent("iniciar",getLocalPlayer()) end ) addEvent("elmota",true) addEventHandler("elmota",root,function() row1 = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1],row1,col,getElementData(mota,"model"),false,false) end ) addEventHandler("onClientGUIClick",root,function() local theItem = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) ) if theItem == "Carrito" and source == GUIEditor.button[1] then x,y,z = getElementPosition(getLocalPlayer()) setElementPosition(mota,x+1,y,z+1) end end ) addCommandHandler("autos",function(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent ( thePlayer, "aparecer", thePlayer ) end end ) addEvent ( "iniciar", true ) addEventHandler ( "iniciar", root, function ( ) local account = getPlayerAccount ( source ) local cuenta = getAccountName ( account ) if ( cuenta == "ElMota" ) then triggerClientEvent ( source, "elmota", source, cuenta ) end end ) Ahora no me aparece nada en el girdlist Link to comment
Castillo Posted December 24, 2012 Share Posted December 24, 2012 Lo vehiculos creados client side no sirven, crealso server side. Link to comment
iFoReX Posted December 24, 2012 Author Share Posted December 24, 2012 ok, pero porque no aparece en el gridlist el item "carrito" ? D: Link to comment
Recommended Posts