Jump to content

[Solucionado] Triggers y elementos perdidos


Recommended Posts

Bueno, hola de nuevo a todos, con un gran HUUUUUUUUUUG (Fuera cocaina)

Bueno, el problema que tengo es que no DESTRUYE el sonido ni el objeto, pero si los crea y los reproduce

Client:

HUUUUUUUUUUUUUUUUUG

function creator (obj, link) 
    if obj ~= nil and link ~= nil then 
    local x,y,z = getElementPosition(obj) 
    local soundBeet = playSound3D(link,x,y,z,false) 
    setSoundMaxDistance(soundBeet, 50) 
    attachElements(obj, soundBeet) 
    end 
end 
addEvent("f5client:create", true) 
addEventHandler("f5client:create", root, creator) 
function onSpeakStop (OBJECT) 
    for k,v in ipairs(getAttachedElements(OBJECT)) do 
    destroyElement(v) 
    end 
destroyElement(OBJECT) 
outputChatBox("Cumplidad") 
end 
addEvent("f5client:stop", true) 
addEventHandler("f5client:stop", root, onSpeakStop) 

Server:

addEvent("f5:create", true) 
addEvent("f5:destroy", true) 
objecT = {} 
function create (link) 
local x,y,z = getElementPosition(client) 
    if link ~= nil then 
    objecT[client] = createObject(2229,x,y+2,z) 
    triggerClientEvent(root, "f5client:create", root, objecT[client], link) 
    end 
end 
addEventHandler("f5:create", root, create) 
function destroy () 
--  for k,v in ipairs(getAttachedElements(objecT[client])) do 
--  destroyElement(v) 
--  end 
triggerClientEvent(root, "f5client:stop", root, objecT[client]) 
--destroyElement(objecT[client]) 
objecT[client] = nil 
end 
addEventHandler("f5:destroy", root, destroy) 
function quit() 
    if objecT[source] ~= nil then 
    triggerClientEvent(root, "f5client:stop", root, objecT[source]) 
    end 
end 
addEventHandler("onPlayerQuit", root, quit) 

Edited by Guest
Link to comment

¿En cuál side fueron creados los elementos?

Returns true if the element was destroyed successfully, false if either the element passed to it was invalid or it could not be destroyed for some other reason (for example, clientside destroyElement can't destroy serverside elements).

Link to comment
¿En cuál side fueron creados los elementos?

Returns true if the element was destroyed successfully, false if either the element passed to it was invalid or it could not be destroyed for some other reason (for example, clientside destroyElement can't destroy serverside elements).

Nada mejor como un copypaste de la wiki xD

Solucionado tomas :D

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...