Search the Community
Showing results for tags 'api'.
-
I am working on teaching myself Lua for modifying ET. So far, it has been going very well, but I ran into a problem that I am having a hard time figuring out. I'm trying to use the following function... clientnum = et.G_ClientNumberFromString( string ) Here is the code that I am using... function et_ClientCommand(clientNum, command) if et.trap_Argv(0) == "listclientnumber" then if et.trap_Argc() == 2 then local targetClientNum = et.G_ClientNumberFromString(et.trap_Argv(1)) et.trap_SendServerCommand(clientNum, string.format("cpm \"%d\"", targetClientNum)) else et.trap_SendServerCommand(clientNum, "cpm \"Error: Need two arguments!\"") end return 1 end return 0 end When I execute the command to run the above code (e.g. "/listclientnumber JvI" in my game console), ET gives an unknown command error due to the G_ClientNumberFromString line. Even if I manually put a string instead of using the argument for the parameter, I still have this problem. If I remove that line and modify the line below it to just print text, it works exactly as intended. The client number function was directly from the lua.html that's located in the silent zip archive. Am I using it incorrectly, or is the documentation possibly out of date? My second question is what is the best way to print text to a clients console? I noticed cpm acts just like echo and also flashes the text on the left side of the main screen. I'd prefer if there was a way of only printing to the console instead so my custom command behaves closer to the built in admin commands. For my last question, is there any way to define standard admin commands that start with '!' instead of the console commands that start with '/' through Lua. I know you can map the admin commands to the console commands, but then I need to restrict the level in the script as well as the shrubbot.cfg file to prevent everyone from using it. Or perhaps there is another way to do this? Thanks, JvIasterMind