Jump to content

ayuda con mi script


Flipi

Recommended Posts

Posted

Hola, tengo un problema con la parte de la funcion cuests con message (linea 17), ya que no me funciona al escribir...ejemplo "!ayuda" ........(lo puse en server-side)...

server:

local msgs = { 'necesita ayuda', 'es noob', 'es malo' } 
local msgss = { 'Carabinero', 'Bachelet', 'Holy Fuuu' } 
local msgsss = { 'No tengo idea', 'Que te ayude tu vieja', 'Mala cuea' }  
  
function cuest( player,text ) 
 local texts = msgs [ math.random ( 1, #msgs )] 
 local texts2 = msgss [ math.random ( 1, #msgss )] 
 local texts3 = msgsss [ math.random ( 1, #msgsss )] 
        if text then 
            outputChatBox ("* #FF8000[Ayuda] #FFFFFF"..getPlayerName(player).." #0080FFpide ayuda porque: #FFFFFF" ..texts.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
            outputChatBox ("* #FF8000"..texts2.." #0080FFle da la solucion: #FFFFFF" ..texts3.. "#0080FF!", getRootElement(), 255, 255, 255, true )  
end 
end 
addCommandHandler ( "ayuda", cuest) 
addCommandHandler ( "jelp", cuest) 
  
function cuests(player,message,messageType,text) 
 if message == "!ayuda" or message =="!jelp" then 
 local texts = msgs [ math.random ( 1, #msgs )] 
 local texts2 = msgss [ math.random ( 1, #msgss )] 
 local texts3 = msgsss [ math.random ( 1, #msgsss )] 
    if text then 
            outputChatBox ("* #FF8000[Ayuda] #FFFFFF"..getPlayerName(player).." #0080FFpide ayuda porque: #FFFFFF" ..texts.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
            outputChatBox ("* #FF8000"..texts2.." #0080FFle da la solucion: #FFFFFF" ..texts3.. "#0080FF!", getRootElement(), 255, 255, 255, true )  
    end 
end 
end 
addEventHandler("onPlayerChat",getRootElement(),cuests) 

Posted
El comando "/ayuda" funciona?

P.D: Es "help" no "jelp".

si, si funciona, pero el que no funciona es la parte de abajo "!jelp o !ayuda"

P.D: yo le puse "jelp" xD

Posted
function cuests(player,message,messageType,text) 

Ese es el problema, onPlayerChat solo tiene 2 argumentos: mensaje, tipoDeMensaje.

Borra 'player' de ahi y tambien 'text'.

Luego cambia 'player' por 'source' en las otras funciones ( getPlayerName, etc ).

Posted
function cuests(player,message,messageType,text) 

Ese es el problema, onPlayerChat solo tiene 2 argumentos: mensaje, tipoDeMensaje.

Borra 'player' de ahi y tambien 'text'.

Luego cambia 'player' por 'source' en las otras funciones ( getPlayerName, etc ).

asi?

function cuests(message,messageType) 
 if message == "!ayuda" or message =="!jelp" then 
 local texts = msgs [ math.random ( 1, #msgs )] 
 local texts2 = msgss [ math.random ( 1, #msgss )] 
 local texts3 = msgsss [ math.random ( 1, #msgsss )] 
    if text then 
            outputChatBox ("* #FF8000[Ayuda] #FFFFFF"..getPlayerName(source).." #0080FFpide ayuda porque: #FFFFFF" ..texts.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
            outputChatBox ("* #FF8000"..texts2.." #0080FFle da la solucion: #FFFFFF" ..texts3.. "#0080FF!", getRootElement(), 255, 255, 255, true )  
    end 
end 
end 
addEventHandler("onPlayerChat",getRootElement(),cuests) 

Posted
Si, pero, donde esta definido 'text'?

lo puse asi, pero tampoco funciona... o como tendria que ser?

function cuests(message,messageType,text) 
 if message == "!ayuda" or message =="!jelp" then 
 local texts = msgs [ math.random ( 1, #msgs )] 
 local texts2 = msgss [ math.random ( 1, #msgss )] 
 local texts3 = msgsss [ math.random ( 1, #msgsss )] 
    if text then 
            outputChatBox ("* #FF8000[Ayuda] #FFFFFF"..getPlayerName(source).." #0080FFpide ayuda porque: #FFFFFF" ..texts.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
            outputChatBox ("* #FF8000"..texts2.." #0080FFle da la solucion: #FFFFFF" ..texts3.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
    end 
end 
end 
addEventHandler("onPlayerChat",getRootElement(),cuests) 

Posted
Eso es porque 'text' es siempre nil, no deberias usar 'texts'?

no entiendo :(

function cuests(message,messageType) 
 if message == "!ayuda" or message =="!jelp" then 
 local texts = msgs [ math.random ( 1, #msgs )] 
 local texts2 = msgss [ math.random ( 1, #msgss )] 
 local texts3 = msgsss [ math.random ( 1, #msgsss )] 
            outputChatBox ("* #FF8000[Ayuda] #FFFFFF"..getPlayerName(source).." #0080FFpide ayuda porque: #FFFFFF" ..texts.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
            outputChatBox ("* #FF8000"..texts2.." #0080FFle da la solucion: #FFFFFF" ..texts3.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
end 
end 
addEventHandler("onPlayerChat",getRootElement(),cuests) 

Posted
function cuests(message,messageType) 
 if message == "!ayuda" or message =="!jelp" then 
 local texts = msgs [ math.random ( 1, #msgs )] 
 local texts2 = msgss [ math.random ( 1, #msgss )] 
 local texts3 = msgsss [ math.random ( 1, #msgsss )] 
            outputChatBox ("* #FF8000[Ayuda] #FFFFFF"..getPlayerName(source).." #0080FFpide ayuda porque: #FFFFFF" ..texts.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
            outputChatBox ("* #FF8000"..texts2.." #0080FFle da la solucion: #FFFFFF" ..texts3.. "#0080FF!", getRootElement(), 255, 255, 255, true ) 
end 
end 
addEventHandler("onPlayerChat",getRootElement(),cuests) 

era solo quitar el text?, gracias :D!!

Posted
ya se a lo que te refieres, era un problema mio, igual gracias por todo, ya funciona :D

No veo por que habría que comprobar si 'texts', 'texts2' y 'texts3' existen, siempre están definidos.

Posted
ya se a lo que te refieres, era un problema mio, igual gracias por todo, ya funciona :D

No veo por que habría que comprobar si 'texts', 'texts2' y 'texts3' existen, siempre están definidos.

aah oks :D gracias por todo! :)

  • Recently Browsing   0 members

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