Chuckun Posted January 27, 2014 Share Posted January 27, 2014 (edited) I know that typing [g] shows your silEnT GUID and typing it into fireteam chat whilst not in a fireteam will work to do it privately, but for absolute security, I wanted to make a custom command of !myguid so I made this LUA script.. Problem is I have never ever touched anything LUA or ET related, so I have no idea if this will even work and I have no means of testing it.. So I wonder if someone can tell me if I've done anything wrong, and/or if it will actually work? ---------------------------------------------------------------------- -- Filename: myguid.lua ---------------------------------------------------------------------- -- MyGUID - Prints your silEnT GUID just like /cl_guid would for etkey based GUIDs. ---------------------------------------------------------------------- -- Created by =F|A=Chuckun -- If you use it, please donate to our clan to help fund the servers -- Any amount will help!! -- Fearless-Assassins.com ---------------------------------------------------------------------- -- For use with shrubbot, exec 'getmyguid' ---------------------------------------------------------------------- description = "silEnT GUID Command" version = "1.0" function et_InitGame(levelTime,randomSeed,restart) local modname = string.format("%s", description) et.G_Print(string.format("%s loaded\n", modname)) et.RegisterModname(modname) end function et_ConsoleCommand(command) if et.trap_Argv(0) == "getmyguid" then local userinfo = et.trap_GetUserinfo( playerID ) local guid = et.Info_ValueForKey( userinfo, "sil_guid" ) et.trap_SendServerCommand(clientNum, "print \"^osilEnT GUID: ^7"..guid.."\n") end return 1 end Or perhaps there's an easier way to simply print the GUID within the command's exec line, with no need for any LUA mod? Edited January 27, 2014 by Chuckun hellreturn 1 Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted January 27, 2014 Management Share Posted January 27, 2014 [command]command = myguidexec = m [g]desc = Tell me my guidsyntax =levels = 0 1 2 3 4 5 You could make a custom command that sends you a private message. As an alternative. Chuckun, hellreturn and Jhonny/Shinobi 3 Quote Link to comment Share on other sites More sharing options...
loudness Posted January 27, 2014 Share Posted January 27, 2014 (edited) ------------------------------------------------------------------------ Filename: myguid.lua------------------------------------------------------------------------ MyGUID - Prints your silEnT GUID just like /cl_guid would for etkey based GUIDs.------------------------------------------------------------------------ Created by =F|A=Chuckun-- If you use it, please donate to our clan to help fund the servers-- Any amount will help!!-- Fearless-Assassins.com------------------------------------------------------------------------ For use with shrubbot, exec 'getmyguid'----------------------------------------------------------------------description = "silEnT GUID Command"version = "1.0" -- is not used in any functionfunction et_InitGame(levelTime,randomSeed,restart) local modname = string.format("%s", description) et.G_Print(string.format("%s loaded\n", modname)) et.RegisterModname(modname)endfunction et_ConsoleCommand(clientNum, command) if et.trap_Argv(0) == "getmyguid" then local guid = et.Info_ValueForKey(et.trap_GetUserinfo(playerID),"sil_guid") et.trap_SendServerCommand(clientNum, "print \"^osilEnT GUID: ^7"..guid.."\n") return 1 ---return 1 here...if not have getmyguid comand will be 0..unreconize comand endend im begginer too...usualy i hunt logs for errors ....but i thik like this will work gaoesa solution is better no lua Edited January 27, 2014 by loudness Chuckun 1 Quote Link to comment Share on other sites More sharing options...
Chuckun Posted January 27, 2014 Author Share Posted January 27, 2014 (edited) Thank you gaoesa and loudness! Although I like the simplicity of the PM idea, it's a bit sloppy for my taste (i'm just quite particular I guess), but I appreciate it's functionality.. If anyone has a test server they could test the LUA on that would be handy (Moving the positive return into the scope of the IF clause as pointed out by loudness).. If not it will have to wait until I have time to do my first server setup Edited January 27, 2014 by Chuckun NoGooD 1 Quote Link to comment Share on other sites More sharing options...
Micha! Posted January 29, 2014 Share Posted January 29, 2014 No it wont work because of:function et_ConsoleCommand(clientNum, command)--Called when a command is entered on the server console should be et_ClientCommand( clientNum, command ) -> Called when a command is received from a client if et.trap_Argv(0) == "getmyguid" then local guid = et.Info_ValueForKey(et.trap_GetUserinfo(playerID),"sil_guid")--playerID is nil -> not defined et.trap_SendServerCommand(clientNum, "print \"^osilEnT GUID: ^7"..guid.."\n")--clientNum is nil (see above) return 1 ---return 1 here...if not have getmyguid comand will be 0..unreconize comand endend fixed lua and I added !help myguid. You could also add a check level to just give it to some admins. ---------------------------------------------------------------------- -- Filename: myguid.lua ---------------------------------------------------------------------- -- MyGUID - Prints your silEnT GUID just like /cl_guid would for etkey based GUIDs. ---------------------------------------------------------------------- -- Created by =F|A=Chuckun -- If you use it, please donate to our clan to help fund the servers -- Any amount will help!! -- Fearless-Assassins.com ---------------------------------------------------------------------- -- !myguid or /!myguid ---------------------------------------------------------------------- ------------------------------------------ name ---------------------------------------------- Modname = "silEnT GUID Command" Version = "1.0" ------------------------------------------ settings ---------------------------------------------- commandprefix = "!" --command prefix (! shrubbot like) myguid_cmd = "myguid" --shrubbot command (can be shortened to example "myg" --just like !listplayers -> !list !listp !listplay printposition = "chat" --message position ----------------------------------------- functions --------------------------------------------- function et_InitGame(levelTime,randomSeed,restart) et.G_Print("["..Modname.."] Version: "..Version.." Loaded\n") et.RegisterModname(Modname.." "..Version.. " "..et.FindSelf()) end ---------------------------------- client command functions ------------------------------ function et_ClientCommand(client, command) local argv0 = string.lower(et.trap_Argv(0)) --first argv if you use / will be myguid_cmd local argv1 = string.lower(et.trap_Argv(1)) --et.trap_Argv(0) is say/say_buddy/say_team and et.trap_Argv(1) is myguid_cmd local argv2 = string.lower(et.trap_Argv(2)) --string.lower so you ca write it in upper and/or lower letters -------//--------------------Command---------------------------- if string.find(argv0, "^"..commandprefix.."" .. myguid_cmd .. "") or string.find(argv1, "^"..commandprefix.."" .. myguid_cmd .. "") then --use string.find so it's not needed to write full command. local userinfo = et.trap_GetUserinfo( client ) local guid = string.upper(et.Info_ValueForKey( userinfo, "sil_guid" )) if guid == nil or guid == "" then guid = "UNKNOWN" end --in case client doesn't have no guid set it to UNKNOWN et.trap_SendServerCommand(client, ""..printposition.." \"^osilEnT GUID: ^7"..guid.."\"") if string.find(argv0, "^"..commandprefix.."" .. myguid_cmd .. "") then return 1 --return 1 so no error message will be printed^if /command is used end end if argv1 == ""..commandprefix.."help" and string.find(argv2, "^" .. myguid_cmd .. "") then -- !help myguid et.trap_SendServerCommand(client, ""..printposition.." \"^oFunction: ^7print your ^osilEnT GUID\"" ) end return 0 end Quote Link to comment Share on other sites More sharing options...
Chuckun Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) @Micha! - thanks for your help The LUA was actually to catch the server executed command via shrubbot (so user types !myguid, shrubbot catches it and execs the function defined in the LUA script - the script itsself was not supposed to catch "!myguid" as shrubbot will do that for you and exec the 'getmyguid' function However, I've taken on board the other points you mentioned, and should be able to successfully finish the mod Thank you! Edited January 29, 2014 by Chuckun Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.