Tryed Bash's script Risingmoon DEV - Powered by Discuz!, but seems iweb and pwadmin works more different than i thought.
If some1 know how to remake that script for pwadmin, that would be great
p.s. thx.
p.p.s. sorry for my bad english.
Tryed Bash's script Risingmoon DEV - Powered by Discuz!, but seems iweb and pwadmin works more different than i thought.
If some1 know how to remake that script for pwadmin, that would be great
p.s. thx.
p.p.s. sorry for my bad english.
Last edited by ivanaivana; 16-01-11 at 10:31 PM. Reason: p.p.s. edited :D
No it doesn't need iWeb, all it needs is the protocol API which every server release has
pwAdmin include it so it would run fine as well with pwAdmin however it is not a pwAdmin plugin you would have to edit the include/classpath for it to work properly
Thx alot, will try to do some noobish magic with protocols :D
Ok i tryed and no results :D
Code broadcast.jsp
Cron test anonsCode:<%@page contentType="text/html; charset=UTF-8"%> //this is to see russian simbols <%@page import="java.lang.*"%> <%@page import="java.util.*"%> <%@page import="java.text.SimpleDateFormat"%> // copy from pwadmin <%@page import="org.apache.commons.lang.StringEscapeUtils"%> <%@page import="protocol.*"%> <%@page import="com.goldhuman.auth.*"%> <%@page import="com.goldhuman.util.*"%> <%@page import="org.apache.commons.logging.Log"%> <%@page import="org.apache.commons.logging.LogFactory"%> <%@page import="java.io.*"%> <%@page import="java.sql.*"%> <%@page import="org.apache.axis.encoding.Base64"%> // copy from pwadmin <%@include file="../../WEB-INF/.pwadminconf.jsp"%> // copy from pwadmin <% boolean allowed = true; //so we don need enter password for pwadmin if(request.getSession().getAttribute("ssid") != null) { allowed = true; } %> <% String msg = "Automatic Broadcast System Test"; try { protocol.DeliveryDB.broadcast((byte)9,-1,msg); } catch (Exception e) { out.println("<font color=red>Error Attempting to Broadcast Message!</font>"); } %> <% out.println("<font color=green>Successfully Sent Broadcast Message!</font>"); %>
What is wrong?Code:/opt/jetty-7.2.0/webapps/pwadmin/broadcast.jsp xx xx * * * *
Last edited by ivanaivana; 17-01-11 at 02:10 PM.
use a script; example:
cron
aa1.shCode:00 * * * * root /etc/cron.pw/aa1.sh
aa1.jspCode:#!/bin/sh wget http://127.0.0.1:8080/pwAdmin/AA/aa1.jsp rm *jsp*
Code:<%@page contentType="text/html; charset=GBK"%> <%@page import="java.lang.*"%> <%@page import="java.util.*"%> <%@page import="java.text.*"%> <%@page import="org.apache.commons.lang.StringEscapeUtils"%> <%@page import="protocol.*"%> <%@page import="com.goldhuman.auth.*"%> <%@page import="com.goldhuman.util.*"%> <%@page import="org.apache.commons.logging.Log"%> <%@page import="org.apache.commons.logging.LogFactory"%> <%@page import="java.io.*"%> <%@page import="java.sql.*"%> <% // // Coded by [B]aSH from Vendetta Gaming Network. // String msg = "PUT ANNOUNCEMENT HERE"; try { protocol.DeliveryDB.broadcast((byte)9,-1,msg); } catch (Exception e) { out.println("<font color=red>Error Attempting to Broadcast Message!</font>"); } %> <% out.println("<font color=green>Successfully Sent Broadcast Message!</font>"); %>
It works![]()
YW ;)
Just to explain why (in case you wanted to know, or whatever) cron directly calls whatever you tell it to. Well there is no way to 'execute' a .JSP from 'bash'. You can call the JSP using wget, so to make it automated as desired you make the simple script to be activated automatically by cron, which in turn uses wget to call the announcement JSP
;) :D
---------- Post added at 02:08 PM ---------- Previous post was at 02:05 PM ----------
so ofc the way cron is (it's really nice because) you can make almost unlimited numbers of these announce scripts & JSPs, ie... you could make one run hourly that announces "welcome to xxx server", you could make one run every year at new years (at midnight your server time) that announces "happy new year" etc etc etc... :D
Last edited by 343; 17-01-11 at 08:13 PM.
I have about 3-4 handmade (not Pwi events) automated events runnin a day, that runs without GM's, also 5 waves of ADC invasion at evenin automated. I placed all information about "when and where all that stuff starts", but we all know that players are lazy and don read wiki's at all.
Since last year autumn i searched for some sort of auto announcements to free-up GM's time.
So i've made about 10 dayli anonsso ofc the way cron is (it's really nice because) you can make almost unlimited numbers of these announce scripts & JSPs, ie... you could make one run hourly that announces "welcome to xxx server", you could make one run every year at new years (at midnight your server time) that announces "happy new year" etc etc etc... :D![]()
Last edited by ivanaivana; 17-01-11 at 08:51 PM.
awesome!
You missed in your script "//Created by Bash from Vendetta Gaming Network" out of respect, just because you modified a bit doesnt entitle you to remove that.
Also PWAdmin folder shouldnt be used to create new jsp always use the iweb folder and reboot your java service clearing your cache so any changes or new additions will be added without an issue.
I didnt shared it, didnt say that my script. Look 1st post.
Just cleared coz them locked and no need to keep in 10+ files... i have your clear script with copyrights in my @downloaded@ folder.
If you ll look second script without copyrights, there is some parts of chat.jsp from pwadmin - i cant place there only bash... and that mixed script didnt work.
I shared some calculations for battle pets page seledit in forum, but didnt placed there copyrights, coz not me created seledit, not me created pw and formulas i made - is some sort of original wanmei core formulas, i just found it thru tests.
p.s. thx for script and don be like this ===>"YOU SNEAKE STEALER!!!11 WHERE IS MY NAME IN ALL YOUR 10+ NO ONE SEEING SCRIPTS CHMOD 644???777"
Last edited by ivanaivana; 18-01-11 at 11:40 AM.
I am just messing around :P
Wrong page.....
Last edited by twiggy345; 10-02-11 at 11:01 PM. Reason: wrong page
trigger has time to start (xxx) and time to end (yyy) in npcgen, cron activates anons script about start at (xxx) and anons script about finish at (yyy).
you can edit triggers with a npcgen-editors, there is a few workable full npcgens.
I've been trying to get one to work still, can you post a example or a working one or pm it to me?
Im at work now and dont have my files here. Gimme a screenshoot of your trigger in npcgen and paste a codes: java, php and cron. Ill look and say where are mistakes.
6 Hours Ago - some sort of 4 am in my town :D
I'd actually recommend just using php5-cli over that
and usePHP Code:<?php
function broadcast($message){
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if($sock){
if(socket_connect($sock, "127.0.0.1", 29100)){
socket_set_block($sock);
$data2 = mByte(9) . mByte(0) . mInt(-1) . mInt(0) . mString($message);
$data = mUInt32(79) . mUInt32(strlen($data2)) . $data2;
socket_send($sock, $data, 8192, 0);
socket_set_nonblock($sock);
socket_close($sock);
echo "Message Sent Successfully";
} else {
echo "Message Sending Failed";
}
}
}
// pack - http://ru2.php.net/pack
function mByte($p) { return pack('C', $p & 0xFF); }
function mf($i, $j) { return ($i >> $j) & 0xFF; }
function mBytes($p, $from)
{
$packed = '';
for ($i = $from; $i >= 0; $i -= 8)
$packed .= mByte(mf($p,$i));
return $packed;
}
function mChar($p) { return mByte(mf($p,0)) . mByte(mf($p,8)); }
function mString($s)
{
$s=iconv('utf-8','utf-16le',$s);
$ret = mUInt32(mb_strlen($s));//mUInt32(count($s) * 2);
$s=array_merge(unpack("n*",$s));
for ($i = 0;$i < count($s); $i++)
{
$ret .= mByte(($s[$i]) >> 8);
$ret .= mByte($s[$i]);
}
return $ret;
}
function mShort($p) { return mBytes($p,8); }
function mInt($p) { return mBytes($p,24); }
function mLong($p) { return mBytes($p,56); }
function mUInt32($p) {
if ($p < 64)
return mByte($p);
if ($p < 16384)
return mShort($p | 0x8000);
if ($p < 536870912)
return mInt($p | 0xC0000000);
return mInt(-32) . mInt($p);
}
function mSInt32($p) {
if ($p >= 0)
return mUInt32($p);
$t=-$p;
if ($t < 64)
return mByte($p | 0x40);
if ($t < 16384)
return mShort($p | 0xA000);
if ($t < 536870912)
return mInt($p | 0xD0000000);
return mInt(-16). mInt($p);
}
function mOctets($p) {
$packed = mUInt32(count($p));
for ($i = 0; $i < count($p); $i++)
$packed .= mByte($p[$i]);
return $packed;
}
broadcast($argv[1]);
?>
php whateveryoucalledit.php "Message to broadcast"
This doesn't rely on the JSP server running and you can run it from any server that has PHP-CLI support
Last edited by das7002; 10-08-11 at 08:04 PM.
I will remember that. Thanks 343.
Sorry das7002, I'm still a nob at code, and 343's way looks easier for me to do, but I would gladly try yours, if you wouldn't mind explaining were to put everything.Thanks for the response.
Last edited by jh281978; 13-07-11 at 07:18 PM.
dos7002, were does the message go into the code that I want to broadcast.
Like I said
Just remember to keep message in quotes.Code:php whateveryoucalledit.php "Message to broadcast"
The code can just be save as whateveryoucalledit.php and as long as php5-cli is installed it will run by sending the message directly to gdeliveryd and skipping Java entirely.
You could also run it from a web server by changing the last line where it says broadcast($argv[1]); ($argv is all the argument given by the cli) but I've already got something like that originally in PW Chat...
Last edited by das7002; 14-07-11 at 12:01 AM.
Just kinda offtopicish, whats the best way to make a loop script in ubuntu? Im making a script that checks what time it is and shutsdown the server if its a certain time and i need it to loop to the if time =...
Posted via Mobile Device