-
Posts
6 -
Joined
Content Type
Profiles
Forums
Store
Articles
A20 Bugs
A21 Bugs
Events
Posts posted by max2go
-
-
7d night not working correctly... (A15 pre)
Thank you for your hook-script; however:
1. sOut="$(telnetCommand $1 "lkp $3")" would return me an empty time; I removed the $3 (thus, that part of the string I have now is "lkp") and that fixed it.
2. I (and all other players) always get "6 days until next 7day horde.", regardless of the day. Any idea for a fix?
I'm running latest A15 (beta), perhaps that has changed the lkp command not accepting a parameter, and also messes up the calc of the horde night?
Also a bit of a P.S.:
Do you / others have any other scripts to share? I'm working right now on the implementation of custom commands (such as: "/admin help me!", which would send an email to me with this text and the player's steam64id and at that time in-game name; this is still a WIP but when done, I'll post it here). Or is there a website with collection of those?
Thanks Alloc, zigstum and everyone else for your hard work and participation!
Thanks for the tips Alloc, I got it workingBut I have another question: Is it possible to chain the telnet commands together?
EG: telnetCommand $1 "sayplayer player \"message1\""; "sayplayer player \"message 2\""; etc...
To avoid spamming the telnet connection for consecutive 'say commands'.
For anyone else that wants to use it, it displays welcome message, users playtime, days until next 7 day horde. It goes into the 'playerConnect' hooks folder. It uses PM to avoid global spam.
#!/bin/bash . /usr/local/lib/7dtd/common.sh ###Strindex - http://stackoverflow.com/questions/5031764 strindex() { x="${1%%$2*}" [[ $x = $1 ]] && echo -1 || echo ${#x} } ###Get current day### #get telent 'gt' response sGT="$(telnetCommand $1 "gt")" #extract day string sData=$(echo "$sGT" | egrep -o '^Day [0-9]{1,}') #divide by 7, get remainder iDay=$( expr ${sData:4} % 7) #build seven day message sSDMsg="There are [00FF00]$iDay days[-] until next 7day horde." ###Get player details### sOut="$(telnetCommand $1 "lkp $3")" #Find the desired string beginning iPlNmStrt=$(strindex "$sOut" "1. $3,") #Find the desired string end. iPlNmEnd=$(strindex "$sOut" "Total of ") #Calculate length iOutStrLen=$(expr $iPlNmEnd - $iPlNmStrt) #Grab the string. sLKPStr="${sOut:$iPlNmStrt:$iOutStrLen-2}" ###Get string parts into array OIFS=$IFS; #store existing sep IFS="," #Change the separator to comma aLkpArr=($sLKPStr) #serialise IFS=$OIFS #return to default sep ###Playtime. vPlTme="${aLkpArr[5]}" sPlTme="${vPlTme:10:-2}" ###Build mesages sMsg1="Welcome [00FF00]$3[-]!" sMsg2="Playtime: [00FF00]$sPlTme mins[-]" sMsg4="7 Nights 2 Live is an EU based PVE server. \ No Player killing or Griefing is allowed. \ Server Map: [FFFF00]http://7n2l.com[-]" ###Send messages telnetCommand $1 "sayplayer $3 \"$sMsg1\"" telnetCommand $1 "sayplayer $3 \"$sMsg2\"" telnetCommand $1 "sayplayer $3 \"$sSDMsg\"" telnetCommand $1 "sayplayer $3 \"$sMsg4\""
- - - Updated - - -
What setup do you have? Can you add a cron job? How do you start your server normally?
Need to know setup before can give advice.
0
Current high demand Pimp Dreams (Constant W.I.P)
in Pimp Dreams
Posted
Better tree-house building. I just tried and even building carefully, everything came crashing down. Please make it viable!