Jump to content

Ayuda


Flipi

Recommended Posts

Hola, me gustaria saber como hacer para agregar diversos tipos de mensajes al morir, que no solo diga "murio", sino que otros mensajes mas con math.random, pero no logro hacerlo.

function playerDied(totalAmmo, killer, killerWeapon, bodypart) 
    outputChatBox('* #FFFFFF'..getPlayerName(source)..' #0080FFMurio!',getRootElement(),255,255,255,true) 
end 
addEventHandler("onPlayerWasted",getRootElement(),playerDied) 

Intente hacer esto pero no logro armarlo:

local msgs = { 'noob', 'murio', 'diee!' } 
  
setTimer(function playerDied(totalAmmo, killer, killerWeapon, bodypart) 
    local text = msgs[math.random(1, #msgs)] 
      outputChatBox (getPlayerName(source).. text, root, 255, 255, 255, true) 
    else 
        outputChatBox(text, root, 255, 255, 255, true) 
end 
    addEventHandler("onPlayerWasted",getRootElement(),playerDied) 
end, 25000, 0) 

Link to comment
local msgs = { 'noob', 'murio', 'diee!' } 
  
function playerDied ( totalAmmo, killer, killerWeapon, bodypart ) 
    local text = msgs [ math.random ( 1, #msgs ) ] 
    outputChatBox ( getPlayerName ( source ) .. text, root, 255, 255, 255, true ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), playerDied ) 

Link to comment
local msgs = { 'noob', 'murio', 'diee!' } 
  
function playerDied ( totalAmmo, killer, killerWeapon, bodypart ) 
    local text = msgs [ math.random ( 1, #msgs ) ] 
    outputChatBox ( getPlayerName ( source ) .. text .. getBodyPartName ( bodypart ) .. !, root, 255, 255, 255, true ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), playerDied ) 

Link to comment

gracias, puedo hacerte una pregunta, esto está bien?, es algo parecido, pero cuando el jugador se va del server..

local msgs = { ' fue la baño!', ' lo reto su mamá!', ' no pagó el internet!', ' se le fundio el pc!'  } 
  
addEventHandler ( "onClientPlayerQuit", g_Root,   
function(reason) 
    local text = msgs [ math.random ( 1, #msgs ) ] 
    outputChatBox ('* #FFFFFF'..getPlayerName ( source ).. text "#0080FF[#FFFFFF"..reason.."#0080FF]", root, 255, 255, 255, true ) 
end 
) 

Link to comment
local msgs = { 'noob', 'murio', 'diee!' } 
  
function playerDied ( totalAmmo, killer, killerWeapon, bodypart ) 
    local text = msgs [ math.random ( 1, #msgs ) ] 
    outputChatBox ( getPlayerName ( source ) .. text .. getBodyPartName ( bodypart ) .. !, root, 255, 255, 255, true ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), playerDied ) 

me arroja un error,

lua: 5: Bad argument @ 'getBodyPartName'

lua: 5 : attempt to concatenate a boolean value

Link to comment
local msgs = { 'noob', 'murio', 'diee!' } 
  
function playerDied ( totalAmmo, killer, killerWeapon, bodypart ) 
    local text = msgs [ math.random ( 1, #msgs ) ] 
    outputChatBox ( getPlayerName ( source ) .." ".. text .." ".. getBodyPartName ( bodypart ) or "N/A" .." !", root, 255, 255, 255, true ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), playerDied ) 

Link to comment
local msgs = { 'noob', 'murio', 'diee!' } 
  
function playerDied ( totalAmmo, killer, killerWeapon, bodypart ) 
    local text = msgs [ math.random ( 1, #msgs ) ] 
    outputChatBox ( getPlayerName ( source ) .." ".. text .." ".. getBodyPartName ( bodypart ) or "N/A" .." !", root, 255, 255, 255, true ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), playerDied ) 

dice lo mismo:

lua: 5: Bad argument @ 'getBodyPartName'

lua: 5 : attempt to concatenate a boolean value

Link to comment
local msgs = { 'noob', 'murio', 'diee!' } 
  
function playerDied ( totalAmmo, killer, killerWeapon, bodypart ) 
        if bodypart then 
            local text = msgs [ math.random ( 1, #msgs ) ] 
            outputChatBox ( getPlayerName ( source ) .." ".. text .." ".. getBodyPartName ( bodypart ).." !", root, 255, 255, 255, true ) 
        end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), playerDied ) 

Link to comment

gracias :D!, una pregunta, esta bien asi este script? (nose como probarlo, ya que es con el evento quit).

g_Root = getRootElement() 
  
local msgs = { ' Fue la baño!', ' Lo reto su mamá!', ' No pagó el internet!', ' Se le fundio el pc!', ' Se canso de ser malo!' } 
  
addEventHandler ( "onClientPlayerQuit", g_Root,   
function(reason) 
    local text = msgs [ math.random ( 1, #msgs ) ] 
    outputChatBox ('* #FFFFFF'..getPlayerName ( source ).. text .."["..reason.."]", root, 255, 255, 255, true ) 
end 
) 

Link to comment
  
local messageQuit = "" 
mensajesQuit = { ' Fue la baño!', ' Lo reto su mamá!', ' No pagó el internet!', ' Se le fundio el pc!', ' Se canso de ser malo!' } 
  
addEventHandler ( "onClientPlayerQuit", root,   
function(reason) 
      messageQuit =  outputChatBox ('* #FFFFFF'.. getPlayerName( source ) .. ' #ffffff'..mensajesQuit[math.random(1,#mensajesQuit)]..'.', "["..reason.."]", root, 255, 255, 255, true ) 
end 
) 

Link to comment
  
local messageQuit = "" 
mensajesQuit = { ' Fue la baño!', ' Lo reto su mamá!', ' No pagó el internet!', ' Se le fundio el pc!', ' Se canso de ser malo!' } 
  
addEventHandler ( "onClientPlayerQuit", root,   
function(reason) 
      messageQuit =  outputChatBox ('* #FFFFFF'.. getPlayerName( source ) .. ' #ffffff'..mensajesQuit[math.random(1,#mensajesQuit)]..'.', "["..reason.."]", root, 255, 255, 255, true ) 
end 
) 

Gracias :)!!

Link to comment
  • Recently Browsing   0 members

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