Aller au contenu

Photo

Server message question?


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
 How would I send a server message that players see ingame from the linux command prompt or a bash script?

I have searched but cant find this.

#2
Calvinthesneak

Calvinthesneak
  • Members
  • 656 messages
Depends on if you're using the nwservctl.sh script that skilladron and I suggested.

If you are you can simply use the

./nwservctl.sh say (your message)


This isn't an entire script, I have it posted somewhere else I think.....

#!/bin/bash

cd /home/nwnserver/nwn

./nwservctl.sh say -------------------------------------------
sleep 1
./nwservctl.sh say NOTE: SERVER WILL BE RESTARTING IN 30 MINS PLEASE SAVE AND BE READY
sleep 1
./nwservctl.sh say -------------------------------------------
sleep 600
.....
.....


Modifié par Calvinthesneak, 14 juin 2011 - 06:49 .


#3
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Thanks Calvinthsneak.

Let me explain what Im doing exactly.(trying to do lol)

Im using the nwserctl.sh to run the RP server and that tells the nwsever its going to restart with this in crontab -e ~/nwservctl.sh restart countdown 120

I have another server on same machine I tinker with ..usually my lvlup one but sometimes do a campaign. I have 2 scripts to start it and stop it .I just wanted to also send messages to it .

btw second program I renamed nw_server so maybe something like this?

#!/bin/bash

cd /home/dan/NWN1

./nw_server say -------------------------------------------
sleep 1
./nw_server say NOTE: SERVER WILL BE RESTARTING IN 30 MINS PLEASE SAVE AND BE READY
sleep 1
./nw_server say -------------------------------------------
sleep 600
.....
.....

#4
Calvinthesneak

Calvinthesneak
  • Members
  • 656 messages
Yup sounds about right. The way that script works, is it looks for specific commands. stop, start, restart, status, a few others. If it doesn't get any of those wayyyyy at the bottom the command falls through to the nwserver process to try and handle. So when you use say, it simply uses the nwserver interfact to send a message.

The script name doesn't matter so much as what PID it's tied to. so as long as you're using the name of the script tied to the right PID, it will push the command to that server.