Jump to content

Problema con Argumentos de un addCommandHandler


Alexs

Recommended Posts

Miren, hice este script:

function musicambientalfunc ( modo ) 
local encendida = getElementData ( localPlayer, "musica.on" ) 
    if (encendida) then 
if ( modo == 1 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 2 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 3 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 4 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 5 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == off ) and ( encendida == true ) then 
  stopSound(musicambiental) 
    setElementData ( localPlayer, "musica.on", false ) 
        end 
    end 
end 
addCommandHandler ( "ambiente", musicambientalfunc ) 
  
function dejarenoffalspawn ( ) 
setElementData ( localPlayer, "musica.on", false ) 
end 
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), dejarenoffalspawn ) 

No funciona, al escribir /ambiente 1 no suena nada, pero el debugscript no dice nada, que esta mal?

Link to comment
function musicambientalfunc ( _, modo ) 
local encendida = getElementData ( localPlayer, "musica.on" ) 
    if (encendida) then 
if ( modo == 1 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 2 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 3 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 4 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == 5 ) and ( encendida == false ) then 
  local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") 
    setElementData ( localPlayer, "musica.on", true ) 
  
elseif ( modo == off ) and ( encendida == true ) then 
  stopSound(musicambiental) 
    setElementData ( localPlayer, "musica.on", false ) 
        end 
    end 
end 
addCommandHandler ( "ambiente", musicambientalfunc ) 
  
function dejarenoffalspawn ( ) 
setElementData ( localPlayer, "musica.on", false ) 
end 
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), dejarenoffalspawn ) 

El primer argumento de addCommandHandler client side es el nombre del comando que usaste.

Link to comment
  • Recently Browsing   0 members

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