Jump to content

commands


Recommended Posts

Posted

you cant just change that one letter, to be recognized as commands..

you have to use "onPlayerChat" event, then check if his/her msg starts with "!" and after theres command you want to handle, then handle it.. (and cancell onPlayerChat event)

you will have to rewrite all addCommandHandler from all scripts..

for my opinion -> this is stupid.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

it is really stupid, i'm still wondering why people like old mIRC script commands :D

anyway, you need only something like this:

addEventHandler("onPlayerChat", getRootElement(), 
function (text)
if string.sub(text, 1, 1) == "!" then
cancelEvent()
local command = string.gsub(gettok(text, 1, 32), "!", "")
local args = string.gsub(text, "!"..command, "")
--outputChatBox(getPlayerName(source)..": "..text, getRootElement())
executeCommandHandler(command, source, args)
end
end
)

if you want to display the command typed, uncomment the outputChatBox line.

?

Posted

first of all, you must STOP the server, then modify ACL, then start server..

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
first of all, you must STOP the server, then modify ACL, then start server..

ok this is what i did

stop server /shutdown in game

modified the acl

then i open the server and it shows the error

Posted

Having non-standard characters in resource names probably isn't a good idea anyways. Keep to alphanumerical and underscore (_), it should be enough and is definitely safe.

Do NOT PM ME for help unless invited. - New MTA Script Editor

Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.

Posted

can someone call me a retard please

xD i didnt add commands resource in resources lol im sorry for wasting your time

(its working)

Posted

if you want to display the command typed, uncomment the outputChatBox line.

thats stupid, just don't cancel event then, besides your output is not fully functional

cancelling is done for a reason, you know.

if event is not cancelled, command will be executed BEFORE chat output, since it's called from chat event.

so if the command called prints something to the chat, IT will look stupid.

and exactly what do you mean "not fully functional"?

?

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