Jump to content

Help


joedajoester

Recommended Posts

Posted

Is there a function in scripting that can perform a command from another script? Like in one script, if someone types, can i get a infernus. I got the scripting part to get what someone says. Then the script would output a code like /cv infernus for that player. Would aexec work in a script?

Posted

For this i get error, bad argument @ excuteCommandHandler expected argument at element 2.

function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "love") and string.find(messageclean, "bot")) then 
        outputChatBox("i love you too!", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "hate") and string.find(messageclean, "bot")) then 
        outputChatBox("Ill note that", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "hi") and string.find(messageclean, "bot")) then 
        outputChatBox("Hello", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "how") and string.find(messageclean, "are") and string.find(messageclean, "bot")) then 
        outputChatBox("I'm doing great", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "a") and string.find(messageclean, "infernus")) then 
     executeCommandHandler ( "sv infernus", playerSource ) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 

Posted
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "love") and string.find(messageclean, "bot")) then 
        outputChatBox("i love you too!", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "hate") and string.find(messageclean, "bot")) then 
        outputChatBox("Ill note that", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "hi") and string.find(messageclean, "bot")) then 
        outputChatBox("Hello", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "how") and string.find(messageclean, "are") and string.find(messageclean, "bot")) then 
        outputChatBox("I'm doing great", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "a") and string.find(messageclean, "infernus")) then 
     executeCommandHandler ( "sv infernus", source ) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 

Posted
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "love") and string.find(messageclean, "bot")) then 
        outputChatBox("i love you too!", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "hate") and string.find(messageclean, "bot")) then 
        outputChatBox("Ill note that", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "hi") and string.find(messageclean, "bot")) then 
        outputChatBox("Hello", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "how") and string.find(messageclean, "are") and string.find(messageclean, "bot")) then 
        outputChatBox("I'm doing great", source, 191, 62, 255) 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 
  
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "a") and string.find(messageclean, "infernus")) then 
     executeCommandHandler("sv", source, "infernus") 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 

Posted

As far as I know this was the error (The space between "sv" and "infernus"). like TAPL said it has to be like this :

executeCommandHandler("sv", source, "infernus") 

Posted
function sendMessage2( messageclean, messageType) 
    if (string.find(messageclean, "i") and string.find(messageclean, "love") and string.find(messageclean, "bot")) then 
        outputChatBox("i love you too!", source, 191, 62, 255) 
    elseif (string.find(messageclean, "i") and string.find(messageclean, "hate") and string.find(messageclean, "bot")) then 
        outputChatBox("Ill note that", source, 191, 62, 255) 
    elseif (string.find(messageclean, "hi") and string.find(messageclean, "bot")) then 
        outputChatBox("Hello", source, 191, 62, 255) 
    elseif (string.find(messageclean, "how") and string.find(messageclean, "are") and string.find(messageclean, "bot")) then 
        outputChatBox("I'm doing great", source, 191, 62, 255) 
    elseif (string.find(messageclean, "i") and string.find(messageclean, "a") and string.find(messageclean, "infernus")) then 
        executeCommandHandler("sv", source, "infernus") 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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