Subscriber tapir76 Posted September 17, 2013 Subscriber Share Posted September 17, 2013 helloI need helphow to put expand this script to be able to use this command to enable or disable somethingI mean to use the command " blabla on" " blabla off" use_cmd = 1 function et_ClientCommand(clientNum, command) command = string.lower(command) if (command == "blabla") and (use_cmd == 1) then for i=1,1 do et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^............... \n") end return 1 endend Quote Link to comment Share on other sites More sharing options...
Sol Posted September 17, 2013 Share Posted September 17, 2013 (edited) It can not be used like this way, you have to storage value somewhere.The best way to storage values is MySQL or Filesystem but its more advanced.You can do this instead: CVARNAME = "storage" function et_InitGame( levelTime, randomSeed, restart ) if et.trap_Cvar_Get( CVARNAME ) == nil then et.trap_SendConsoleCommand(et.EXEC_APPEND, string.format("seta %s 0\n", CVARNAME )) end end function et_ClientCommand( num, cmd ) if cmd == "blabla" then if tonumber(et.trap_Cvar_Get( CVARNAME )) == 0 then -- Enable something et.trap_Cvar_Set(CVARNAME, 1) else -- Disable something et.trap_Cvar_Set(CVARNAME, 0) end end end Edited September 17, 2013 by Sol Quote Link to comment Share on other sites More sharing options...
Subscriber tapir76 Posted September 17, 2013 Author Subscriber Share Posted September 17, 2013 Thank youAnd how do you add more commands operating in the same way?in CVARNAME? Quote Link to comment Share on other sites More sharing options...
Sol Posted September 17, 2013 Share Posted September 17, 2013 Thank youAnd how do you add more commands operating in the same way? in CVARNAME?No, you have to add another cvar for it, but there's no point doing it in such a way.You sould use MySQL or file 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.