Jump to content

Cocodrilo

Members
  • Posts

    93
  • Joined

  • Last visited

Everything posted by Cocodrilo

  1. Eso no tiene ningún sentido.
  2. Esto te agrega una columna al scoreboard - "Ocupacion" Y te manda al team "Admin" si eres Admin. Tienes que identificarte primero /login No se si te refieras a eso? exports["scoreboard"]:addScoreboardColumn ("Ocupacion", 3 ) function team ( ) theTeam = createTeam ( "Admin", 143, 143, 16 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), team ) function onlogin ( ) if ( isObjectInACLGroup("user."..getAccountName(getPlayerAccount( source )), aclGetGroup("Admin"))) then setElementData( source, "Ocupacion", "Admin" ) setPlayerTeam (source, theTeam) else setElementData( source, "Ocupacion", "Normal" ) end end addEventHandler ( "onPlayerLogin", getRootElement(), onlogin )
  3. @Serginix Tu codigo está bien pero solo le das la funcion de abrir la gui con el comando. De ahi ya no se cierra. @TomasitoCaram Checa mi codigo, aver que tal
  4. client GUIEditor = { button = {}, window = {}, memo = {}, } PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) guiWindowSetSizable(PanelObjetosMapa, false) guiSetVisible(PanelObjetosMapa,false) Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) guiSetFont(Close, "sa-header") guiSetProperty(Close, "NormalTextColour", "C8E70000") GUIEditor.button[1] = guiCreateButton(-451, -44, 51, 15, "", false, Close) Gate1V = guiCreateButton(10, 50, 70, 27, "Gate1", false, PanelObjetosMapa) Gate8V = guiCreateButton(10, 271, 70, 27, "Gate7", false, PanelObjetosMapa) Gate2V = guiCreateButton(10, 98, 70, 27, "Gate2", false, PanelObjetosMapa) Gate9V = guiCreateButton(10, 317, 70, 27, "Gate8", false, PanelObjetosMapa) Gate3V = guiCreateButton(10, 141, 70, 27, "Gate4", false, PanelObjetosMapa) Gate6V = guiCreateButton(10, 225, 70, 27, "Gate6", false, PanelObjetosMapa) Gate4V = guiCreateButton(10, 184, 70, 27, "Gate5", false, PanelObjetosMapa) Memo = guiCreateMemo(9, 23, 560, 27, "Al hacer click en cada boton aparecera un objeto diferente. ", false, PanelObjetosMapa) guiMemoSetReadOnly(Memo, true) function abrir () if not guiGetVisible( PanelObjetosMapa ) then showCursor ( true ) guiSetVisible( PanelObjetosMapa, true ) else showCursor ( false ) guiSetVisible( PanelObjetosMapa, false ) end end addEvent("showPanel", true) addEventHandler("showPanel", getRootElement(),abrir) function funGate1V( ) triggerServerEvent ( "crearGate1V", getLocalPlayer() ) end addEventHandler("onClientGUIClick", Gate1V , funGate1V, false) function closee( ) guiSetVisible (PanelObjetosMapa,false) showCursor(false) end addEventHandler("onClientGUIClick", Close , closee, false) Server function showGUI ( playerSource) triggerClientEvent ( playerSource, "showPanel", playerSource ) end addCommandHandler ( "panel", showGUI ) function crearG1 () local x, y, z = getElementPosition ( source ) local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) if ( theObject ) then outputChatBox ( "Object created successfully", source, 0, 255, 0 ) else outputChatBox ( "Failed to create Object", source, 255, 0, 0) end end addEvent( "crearGate1V", true ) addEventHandler( "crearGate1V", getRootElement(), crearG1 )
  5. I noticed too late my mistake. ty
  6. Try this client function togglePhone( ) -- Show the phone if not guiGetVisible( phoneGui ) then showCursor ( true ) guiSetVisible( phoneGui, true ) -- Update player list guiGridListClear ( playerList ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) end end else showCursor ( false ) guiSetVisible( phoneGui, false ) end end addEvent("showPhoneGui", true) addEventHandler("showPhoneGui", getRootElement(), togglePhone ) add this to server side function showGUI ( playerSource) if (not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("VIP"))) then outputChatBox ("You're not a VIP Member", playerSource, 255,0,0) return end triggerClientEvent ( "showPhoneGui", playerSource ) end addCommandHandler ( "phone", showGUI ) Pd: You must to be in ACL group "VIP"
  7. You can replace the weapon using engineLoadTXD engineLoadDFF To attach a element to player's hand use "bone_attach" script https://community.multitheftauto.com/ind ... ls&id=2540
  8. Un skin privado para un Team? que team?, para una persona? que persona?, cuando se va a usar ese skin? cuando un player se loguea? cuando un player spawnea? Cuando? Explica con mas exactitud que es lo que quieres hacer.
  9. --Para obtener la data del player getElementData --Para poner la data al scoreboard exports["scoreboard"]:addScoreboardColumn
  10. Checa este ejemplo: Client Side: --Crear una Ventana y ocultarla PANEL = guiCreateWindow(0.27, 0.27, 0.47, 0.58, "", true) guiSetVisible ( PANEL, false ) --Evento para abrir la ventana function open_gui() if guiGetVisible(PANEL) == false then guiSetVisible(PANEL, true) showCursor (true) else guiSetVisible(PANEL, false) showCursor (false) end end addEvent("showGUI", true) addEventHandler("showGUI", getRootElement(), open_gui) Server Side: --Funcion para limitar la GUI mediante un grupo ACL function abrir(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then triggerClientEvent(thePlayer, "showGUI", getRootElement()) end end --Funcion para activar un bind a la GUI cuando se inicia este resource function inicio() for index, player in ipairs(getElementsByType("player")) do bindKey(player, "F5", "down", abrir) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), inicio) --Funcion para activar un bind cuando un player entra al servidor function entrar() bindKey(source, "F5", "down", abrir) end addEventHandler("onPlayerJoin", getRootElement(), entrar) --Function para desactivar el bind cuando el resource es detenido function unbin(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "F5", "down", abrir) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), unbind) Y para las resoluciones te recomiendo usar variables relativas y no absolutas.
  11. Este resource tiene funciones para dar efectos especiales a la gui https://community.multitheftauto.com/in ... ls&id=7812 Post: viewtopic.php?f=108&t=64608&p=617333&hilit=gie#p617333
  12. Server side: function dest ( thePlayer ) local theVeh = getPedOccupiedVehicle ( thePlayer ) if theVeh then destroyElement ( theVeh ) end end addCommandHandler ( "de", dest )
  13. mm.. i don't want to create object with a timer, the objects are created when the resource starts. So I wanna destroy them after have been created with a bindKey. This works: items = { { -1432.12890625, 2672.3349609375, 55.691806793213 }, {-1428.2822265625, 2665.9150390625, 55.6875 }, } addEventHandler ( "onResourceStart", resourceRoot, function() for _,v in pairs ( items ) do local object = createObject ( 929, v[1], v[2], v[3] ) setTimer(destroy, 5000, 1, object) end end ) function destroy(element) if (not isElement(element)) then return end destroyElement(element) end But i want to do something like this: items = { { -1432.12890625, 2672.3349609375, 55.691806793213 }, {-1428.2822265625, 2665.9150390625, 55.6875 }, } addEventHandler ( "onResourceStart", resourceRoot, function() for _,v in pairs ( items ) do local object = createObject ( 929, v[1], v[2], v[3] ) setTimer(destroy, 5000, 1, object) end end ) function destroy(element) if (not isElement(element)) then return end bindkey ( player, "x", "down", function() destroyElement(element) end) end
  14. and if i want to change to bindKey instead of setTimer? items = { {-1434, 2668 , 55.68 }, {-1460, 2669, 55.66 }, } addEventHandler ( "onResourceStart", resourceRoot, function() for _,v in pairs ( items ) do local object = createObject ( 929, v[1], v[2], v[3] ) --[[ Change to bindKey instead of setTimer(destroy, 5000, 1, object) ]] end end ) function destroy(element) if (not isElement(element)) then return end destroyElement(element) end
  15. you don't understand me, or maybe i didn't explain the right way.. i want to do this.. items = { {-1434, 2668 , 55.68 }, {-1460, 2669, 55.66 }, } addEventandler ( "onResourceStart", resourceRoot, function() for_,v in pairs ( items ) do local object = createObject ( 929, v[1], v[2], v[3] ) setTimer(destroy, 5000, 1) end end ) function destroy () destroyElement(object) end but that's not possible cuz destroyElement(object) got a wrong element. I just want to destroy the object from the table 5 seconds after has been created with a function! how to get the object element?
  16. That isn't really i want to do.. I just want to know how to get an object created from a table to then call such object in a function.. for this example.. create the object onResourceStart and call the function ' destroy() ' to destroy it after 5 seconds.
  17. something like this? table1 = { {-1434, 2668 , 55.68 }, {-1460, 2669, 55.66 }, } local obj = {} addEventHandler ( "onResourceStart", resourceRoot, function() for_,v in pairs ( table1 ) do local object = createObject ( 929, v[1], v[2], v[3] ) obj [ooob] = object destroy() end end ) function destroy () setTimer(function() destroyElement(obj[ooob]) obj [ooob] = nil end, 5000, 1) end i do not understand at all yet
  18. I don't think so I want to get the object to then destroy it and use outputChatBox at player.
  19. How to get an element from a table in a función? for example: table1 = { {-1434, 2668, 55.68 }, {-1460, 2669, 55.66 }, } for_,v in pairs ( table1 ) do object = createObject ( 929, v[1], v[2], v[3] ) end function () --get the object created from the table end anyone can help me please
  20. Well, that's done. But now then i hit the marker i use setTimer to re-create the object and marker and that seems fine. The problem is: When i hit the marker all elements from the table are re created. coco2 = { { -1428.4814453125, 2666.4931640625, 55.6875}, {-1434.5478515625, 2668.42578125, 55.6875}, } function crearNeumatico ( ) outputChatBox ("respawn!", player, 0,255,0) for i, v in ipairs ( coco2 ) do local data = "Neumatico!" local clay = "clayN" local id = 1073 local scale = 1 local x,y,z = v[1],v[2],v[3] object = createObject ( id, x, y, z- 0.875, 0, 0, math.random ( 0, 360 ) ) setObjectScale(object, scale ) setElementCollisionsEnabled(object, false) setElementFrozen(object, true) marker = createMarker(x,y,z - 0.875, "cylinder",1,143,143,17,80) setElementData ( marker, data, true ) setElementData ( marker, clay, object ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function () setTimer(crearNeumatico, 50, 1) end) function golpe( hitElement ) local marca = source local elem = getElementData (source, "clayN") if (getElementType( hitElement ) == "player" ) and (getElementData (source, "Neumatico!") == true ) then setTimer ( function() destroyElement(elem) destroyElement( marca ) outputChatBox ("hit", player, 0,255,0) end , 50, 1 ) setTimer(crearNeumatico, 10000, 1) end end addEventHandler( "onMarkerHit", getRootElement(), golpe ) I want to re create only the elements i hit. what is the right way to do?
×
×
  • Create New...