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) 

n-560x95_E60303_FFFFFF_030303_FF0303.png
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) 

CiTLh.png
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") 

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
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) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...