ETPro lua scripting
•
5 May 2010, 22:56
•
Journals
Hello,
I'm trying to create a simple .lua script that would disallow users from using certain commands until they authenticate themselves using a simple command such as /login.
The only problem is that I'm dabbling with the unknown here, as I've never touched LUA before in my life. Here's what I have so far, which I mainly achieved by shamelessly combining elements of the TJMod.lua thing.
However, the problem is that it simply doesn't work. When I enable it on the server, typing in the "disallowed commands" still works and the /login command will just respond with "unknown command". Another problem is that it's likely horridly shitty and poorly done.
So, how could I make this work as intended? I mean, so that players cannot use command /random_disallowed_command before they have done /login?
Also, is there a way to do the same for cvars, so that people wouldn't be able to set, say, cg_autoreload 1 until they do login.
PS: Sorry for fucking up indentation - it's just Crossfire.
I'm trying to create a simple .lua script that would disallow users from using certain commands until they authenticate themselves using a simple command such as /login.
The only problem is that I'm dabbling with the unknown here, as I've never touched LUA before in my life. Here's what I have so far, which I mainly achieved by shamelessly combining elements of the TJMod.lua thing.
However, the problem is that it simply doesn't work. When I enable it on the server, typing in the "disallowed commands" still works and the /login command will just respond with "unknown command". Another problem is that it's likely horridly shitty and poorly done.
So, how could I make this work as intended? I mean, so that players cannot use command /random_disallowed_command before they have done /login?
Also, is there a way to do the same for cvars, so that people wouldn't be able to set, say, cg_autoreload 1 until they do login.
PS: Sorry for fucking up indentation - it's just Crossfire.
Anyways, what I'm trying to achieve is painfully simple so I just hoped someone could point me to the right direction.
i found lua for etpro frustrating at the best of times....
et.trap_Cvar_Set( cvarname, cvarvalue )
then i would imagine you need a callback/event listener so you know when the client enters a command:
et_ClientCommand( clientNum, command )
you would then need to check if the command == "login" and call a function to handle it
which gets the value with:
et.trap_Cvar_Get( cvarname )
and then performs any logic you want
never used LUA but I am a programmer this is how i would imagine its done
function et_ClientCommand( clientNum, command )
gets called when a client types something in their console. However, I might be wrong.
I guess I'll ask on the ETPro forums, which seem awfully dead though.