Jump to content

[Fuego]


user123

Recommended Posts

Hola, encontré este script en un viejo post

   addCommandHandler("fireme", 
    function (thePlayer) 
    local onFire = setTimer(setPedOnFire, 3000, 4, thePlayer, true) 
    outputChatBox("* ".. getPlayerName(thePlayer) .." #0080FFesta en #FF8000fuego#0080FF!",getRootElement(),255,255,255,true) 
    end) 

Como puedo hacer que al escribir /fireme "Jugador" , el nombre del jugador que escribí se prenda fuego

Link to comment

prueba con esto debe funcionar

  
 addCommandHandler("fireme", 
    function (thePlayer, _, name) 
     if not name return end 
        local player = findPlayerByName (name) 
        local onFire = setTimer(setPedOnFire, 3000, 4, player, true) 
        outputChatBox("* ".. getPlayerName(player) .." #0080FFesta en #FF8000fuego#0080FF!",getRootElement(),255,255,255,true) 
    end) 
  
  
  
function findPlayerByName (name) 
    local player = getPlayerFromName(name) 
    if player then return player end 
    for i, player in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then 
            return player 
        end 
    end 
return false 
end 

Link to comment
  
 addCommandHandler("fireme", 
    function (thePlayer, _, name) 
     if not name then return end 
        local player = findPlayerByName (name) 
        local onFire = setTimer(setPedOnFire, 3000, 4, player, true) 
        outputChatBox("* ".. getPlayerName(player) .." #0080FFesta en #FF8000fuego#0080FF!",getRootElement(),255,255,255,true) 
    end) 
  
  
  
function findPlayerByName (name) 
    local player = getPlayerFromName(name) 
    if player then return player end 
    for i, player in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then 
            return player 
        end 
    end 
return false 
end 

Se le olvido poner el then.

Link to comment

Utiliza esto

/fireme nombredeljugador rason

  
 addCommandHandler("fireme", 
    function (thePlayer, _, name, rason) 
     if not name then return end 
        local player = findPlayerByName (name) 
        local onFire = setTimer(setPedOnFire, 3000, 4, player, true) 
        outputChatBox("* ".. getPlayerName(player) .." #0080FFesta en #FF8000fuego#0080FF! rason ("..rason..")",getRootElement(),255,255,255,true) 
    end) 
  
  
  
function findPlayerByName (name) 
    local player = getPlayerFromName(name) 
    if player then return player end 
    for i, player in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then 
            return player 
        end 
    end 
return false 
end 

Link to comment
local onFire = setTimer( 
setPedOnFire,  
3000, 
 4,   -- sera esto? 
player,  
true) 

Eso lo que hace es que se repita, porque el fuego no dura mucho tiempo.

Obviamente es eso. Al morir el timer sigue corriendo.

Usa isPedDead antes de poner al elemento en llamas y en ese caso regresas la funcion a false.

if isPedDead(thePlayer) then 
      return false 
end 

ó puedes usar killTimer en lugar de regresar la funcion a nula.

Link to comment
  • Recently Browsing   0 members

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