Advertisement
Guest User

Untitled

a guest
May 9th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.36 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ###############################################################################
  4. server_name="miniq.dyndns.org"                  #server to connect to
  5. server_port="26000"                         #server port
  6. nick="FruitieX"                             #nick to use for messages to the server
  7. password="bougos"                       #rcon password for server
  8. timeout=180                         #time in seconds before sending AFK message
  9. afkmessage="$nick is AFK right now ($timeout seconds passed)."  #message to send when user did not input anything
  10.  
  11. engine_directory="/home/rasse/Games/Nexuiz/trunk"       #dir where the engine is
  12. engine_name="nexuiz-sdl"                    #name of the engine
  13. user="rasse"                            #run engine as this user
  14. ###############################################################################
  15.  
  16. rcon()
  17. {
  18.     printf "\\xff\\xff\\xff\\xffrcon $password $*" | nc
  19.     -q 0 -u $server_name $server_port
  20. }
  21.  
  22. full_path=$engine_directory/$engine_name
  23. echo "Mr.Bougo wants you to join Bougoserv, join or not (y/n)?";
  24. counter=0
  25. while read -t $timeout inputline;do
  26.     if [ -z "${inputline}" ]; then
  27.         exit
  28.     elif [ "$inputline" = "n" ]; then
  29.         echo "Why not?"
  30.         while read reason;do
  31.         message="$reason"
  32.         rcon say $message
  33.         exit
  34.         done
  35.     elif [ "$inputline" = "y" ]; then
  36.         cd $engine_directory
  37.         su $user -c "$full_path +connect $server_name:$server_port"
  38.         exit
  39.     else
  40.         echo "Enter y or n"
  41.         fi
  42. done
  43. rcon say $afkmessage
  44. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement